Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 how to replace or remove any special characters

Author  Topic 

satishk
Starting Member

39 Posts

Posted - 2006-09-15 : 03:12:01
Hi all,
Can anyone tell me how to replace or remove any
special characters from a column

Satish

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-15 : 03:29:59
[code]UPDATE MyTable
SET MyColumn = REPLACE(MyColumn, CHAR(10), '')[/code]
Replaces CHAR(10) and replaces with empty space.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

satishk
Starting Member

39 Posts

Posted - 2006-09-15 : 03:38:10
how to replace enter

Satish
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-09-15 : 03:46:44
ENTER is char(13)


KH

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-09-15 : 04:38:36
"any special characters is a bit more of a challenge!

Note that you can nest REPLACE:

REPLACE(REPLACE(MyColumn, CHAR(13), ''), CHAR(10), '')

personally, if there are lots of nestings, I prefer this style of layout:

REPLACE(REPLACE(
MyColumn
, CHAR(13), '')
, CHAR(10), '')

as it is easy to add "just one more replace!" by adding another "REPLACE(" at the top, and cloning one of the parameter lines lower down.

Kristen
Go to Top of Page
   

- Advertisement -