DECLARE @str NVARCHAR(4000) 
SELECT 
    @str = COALESCE(@str + ',', '') + CONVERT(VARCHAR, ColumnName1) 
FROM 
    TableName1
 
SELECT @str
VN:F [1.1.6_502]
Rating: 0.0/5 (0 votes cast)
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • DotNetKicks
  • LinkedIn
  • Live
  • MySpace
  • StumbleUpon
  • Technorati

Related posts:

  1. Build DateTime from values
  2. What is the difference between CAST and CONVERT in SQL?
  3. T-SQL Find previous month
  4. T-SQL – How to return null columns with FOR XML
  5. SQL Server CURSOR - loop through records