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
 SQL Server Development (2000)
 SQL String Manipulation Question

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-20 : 09:44:54
Michelle writes "I have a char field (actually Last Names) with numerous inconsistencies in the data such as hyphens "-", quotes,
asterisks, etc that need to be replaced with a space " ".
How do I do this with data that has inconsistent length & positioning of these characters to be removed? It is easily done in VI editor: (1, $ s/-//g), etc. Is there a similar method for an update query or something in SQL?

Thank you very much for your expertise.
Michelle"

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-03-20 : 09:57:25
search here (or Books Online) for the 'replace' keyword....should throw up suitable examples to get you moving.

Go to Top of Page

Jay99

468 Posts

Posted - 2002-03-20 : 10:51:24
After you finish applying your band-aid, don't forget to fix the problem (validate your data on the way in . . . )

Jay
<O>
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-03-20 : 14:10:48
Or better yet, setup the data validation BEFORE you run your update (band-aid) so that you don't have to run the update again later to catch anything new that came in.

------------------------
GENERAL-ly speaking...
Go to Top of Page
   

- Advertisement -