Return to Snippet

Revision: 6428
at May 20, 2008 17:50 by mcbutterbuns


Initial Code
DECLARE @IDlist varchar(100)
SELECT @IDlist = COALESCE(@IDlist + ', ', '') + CAST(id AS varchar(5)) FROM tbl
SELECT @IDlist

Initial URL

                                

Initial Description
If you ever need to build a comma delimited list out of a column in SQL you can easily do this using the COALESCE function.

Initial Title
Comma-Delimited List using Coalesce

Initial Tags
sql, list

Initial Language
SQL