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 2005 Forums
 Transact-SQL (2005)
 getting rid of a chracter (a trailing comma)

Author  Topic 

macsterling
Yak Posting Veteran

56 Posts

Posted - 2009-01-23 : 19:52:43
How do I find a comma and get rid of it when it is somewhere in a column (it follows a name)

gravyface
Starting Member

16 Posts

Posted - 2009-01-23 : 19:59:43
quote:
Originally posted by macsterling

How do I find a comma and get rid of it when it is somewhere in a column (it follows a name)



The REPLACE function:
http://msdn.microsoft.com/en-us/library/ms186862.aspx
Go to Top of Page

Jai Krishna
Constraint Violating Yak Guru

333 Posts

Posted - 2009-01-23 : 22:40:09
SELECT REPLACE(colname,',','')



Jai Krishna
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-24 : 10:51:00
please keep in mind that replace replaces all the occurances of value with replacement value
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-24 : 10:52:46
if its just for extraction of data based on ',' position use CHARINDEX()
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-01-24 : 11:27:47
Duplicate, locking thread.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -