One of the most common questions over forums is a SQL function to remove characters from string. The function for the same is given below.

The above function uses while to loop through the string until all the characters are replaced/removed by empty space. What left is the rest of the string i.e. numbers.

The above query uses tally table to split the string into individual rows and check and then concatenate numeric rows into a string.



Ahmad Osama

Like us on FaceBook Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook