Gert-Jan Strik
3/23/2007 5:28:00 PM
Another solution is something like this:
UPDATE my_table
SET my_column
=CASE WHEN substring(my_column,1,1) LIKE '[a-zA-Z]' THEN
substring(my_column,1,1) ELSE '' END
+CASE WHEN substring(my_column,2,1) LIKE '[a-zA-Z]' THEN
substring(my_column,2,1) ELSE '' END
+CASE WHEN substring(my_column,3,1) LIKE '[a-zA-Z]' THEN
substring(my_column,3,1) ELSE '' END
...
It's not pretty and you need to create one CASE WHEN line for each
character up to the maximum column size, but the query will run like
crazy, because everything can be done in one scan.
HTH,
Gert-Jan
Krishna wrote:
>
> I have a column with data which have alphanumeric and some special
> characters. How do I remove all the characters which are not alphabets [a-z]
> or [A-Z]