To get comma separated list of values of single field in SQL Server

  • 0

To get comma separated list of values of single field in SQL Server

Visit: http://www.zonixsoft.com (our official Website)

A solution to get comma separated list of values of single field of a database table

 

You can use the following code to get the comma separated list of values of a single field of a table:

 

DECLARE @commaSeparatedVal AS VARCHAR(4000)

SELECT @commaSeparatedVal = ISNULL(@commaSeparatedVal +‘,’,) + CONVERT(VARCHAR,[SKU]) FROM PRODUCT

PRINT @commaSeparatedVal

 


Bookmark and Share