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)
 Remove "-" from text in a varchar column field.

Author  Topic 

raisor
Starting Member

28 Posts

Posted - 2004-09-11 : 09:14:31
Hi there,

I have a column with value like 85jdf-84-ii or 4-35-uf-r4
What I need to do is remove the "-", so they would become:
85jdf84ii or 435ufr4

Does anyone know how to do this?

Thanks!

Pat Phelan
Posting Yak Master

187 Posts

Posted - 2004-09-11 : 09:34:45
I'd use:
SELECT Replace(Replace(myColumn, '-', ''), '-', '')
FROM myTable
-PatP
Go to Top of Page

raisor
Starting Member

28 Posts

Posted - 2004-09-11 : 09:43:59
ow......that simple eh :D
THANKS!
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-09-11 : 11:00:00
even simpler - only needs one replace.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

raisor
Starting Member

28 Posts

Posted - 2004-09-11 : 17:50:05
Thanks!,

Found that out as well :)
Go to Top of Page
   

- Advertisement -