Thursday, January 31, 2013

Concatenate many rows into a single text string using SQL Server 2008

Here i will show how to Concatenate many rows into string using sql server 2008...

 Query :



declare @StringConc nvarchar(MAX)
select @StringConc = COALESCE(@StringConc + ',', '') + d.designation  from designation d
print @StringConc
select @StringConc as [stringOutPut]

No comments:

Post a Comment