Thursday, February 25, 2010

Remove special charcters in a column

Sql server provides replace function. By using this we can remove any character and replace with any char.

Example:

my phone number is like 578(45-89564_)

If i want to remove special char's from the above we will do the following.

Replace -,\,),( with blanks

update business set phone1=replace(replace(replace(replace(phone1,'-',''),'',''),')',''),'(','')

No comments:

Post a Comment