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)
 Deleting unwanted spaces within fields

Author  Topic 

waxdart23
Starting Member

33 Posts

Posted - 2004-06-21 : 10:01:02
I am currenly writing scripts to convert data from an old 16 bit proprietry database into a new SQL database. As the data from the old system had no controls over what was entered there is a lot of rubbish, also is stored data in a strange way. I am currently converting phone numbers which are stored with spaces (ie '020 555 1234') the new system will not allow spaces so I would like to clean these out. I cannot find a way of cleaning data from within fields, only the entire field itself.

Thanks
P

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-06-21 : 10:15:46
use replace:

select '123 456 789', replace('123 456 789', ' ', '')


Duane.
Go to Top of Page
   

- Advertisement -