For sake of argument let's return a list of artists from the Artist table. First, a simple select query will return the following results...

The following TSQL code will return our delimited results.
Declare @ArtistAlbum varchar(1000)
Select @ArtistAlbum = coalesce(@ArtistAlbum + ', ', '') + Artist.Name From Artist
Select @ArtistAlbum

No comments:
Post a Comment