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)
 Delete comma from table column data

Author  Topic 

abhit_kumar
Posting Yak Master

147 Posts

Posted - 2011-01-07 : 03:46:48
Dear ALL,

I have a table in which there is one column named "Address1"

Now in this column all the data in this displaying as follow:-

sector-2, Guj,676
Sector-4,AHD,8989

Now i want to modify all the data in this column, if there is any "," comma found in the data, it should delete that comma from the data?

How to do it?

Please guide.

Regards,

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-01-07 : 03:58:25
use the replace() function to remove any comma


update atable
set address1 = replace(address1, ',', '')



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2011-01-07 : 03:58:34
If you want to remove permanently then you can update it.

Update yourtable Set Address1 = Replace(Address1,',','')


If you want to show but not update then
Select Replace(Address1,',','') as Address1 from yourtable
Go to Top of Page
   

- Advertisement -