Surfing the net for a sql answer, I came across something really cool. Below is an example of how to create a comma separated list of values in a single query.
--declare holder var
DECLARE @list VARCHAR(8000)
--build comma separated list
SELECT @list = COALESCE(@list + ', ', '') + CAST(track_id AS VARCHAR(5) )
FROM webtool_tracks
--show results
SELECT @list AS 'list'
The results should look something like this
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment