Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
quote:Originally posted by akash-alo Can anyone show me a way of getting concatenated string all the rows of a table?
Why do you want to do this?MadhivananFailing to plan is Planning to fail
Nageswar9
Aged Yak Warrior
600 Posts
Posted - 2009-08-19 : 08:06:00
Hi , u want this
declare @temp table (id int)insert into @temp select 1insert into @temp select 2insert into @temp select 3insert into @temp select 4insert into @temp select 5insert into @temp select 6select distinct stuff((select distinct ','+cast(id as varchar(32)) from @temp for xml path('')),1,1,'') as val from @temp
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts
Posted - 2009-08-19 : 08:39:10
Try this tooselect (SELECT column_name+ ',' as [text()] FROM table_name FOR XML PATH('')) as alias_nameSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/