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 2008 Forums
 Transact-SQL (2008)
 Delete Comma

Author  Topic 

jscot
Posting Yak Master

106 Posts

Posted - 2011-02-17 : 21:57:22
Hi guys,
Here is sample data
LOS ANGLES,
IRVINE,
DULUTH,

Question:- How i can delete , from city column. Thanks.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-02-17 : 22:05:41
If you want no commas at all:

UPDATE myTable SET City=REPLACE(City, ',', '')

If you only want to remove commas at the very end:

UPDATE myTable SET City=STUFF(City,LEN(City),1, '') WHERE City LIKE '%,'
Go to Top of Page

jscot
Posting Yak Master

106 Posts

Posted - 2011-02-17 : 23:05:11
Robvolk, Thanks for your prompt reply. You solve my Problem, This question Mark as Answer!
Go to Top of Page
   

- Advertisement -