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
 General SQL Server Forums
 New to SQL Server Programming
 row eliminator

Author  Topic 

shaggy
Posting Yak Master

248 Posts

Posted - 2009-02-10 : 04:54:29
Dear friends,

I have a data in a table like this select '1,2,3,4'
i want the result to be select '1','2','3','4'

anyone please advice

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-10 : 05:00:43
SELECT CHAR(39) + REPLACE(Col1, ',', CHAR(39) + CHAR(44) + CHAR(39)) + CHAR(39)
FROM Table1



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

jbp_j
Starting Member

24 Posts

Posted - 2009-02-10 : 05:22:36
hi,

try this one also.

declare @t table(data varchar(1000))
insert into @t select '1,2,3,4'

update @t
set data = ''''+REPLACE(data,',',''',''')+''''
Go to Top of Page

shaggy
Posting Yak Master

248 Posts

Posted - 2009-02-10 : 05:29:34
thanks peso & jbp_j
Go to Top of Page
   

- Advertisement -