Home Forums Article Discussions Article Discussions by Author Discuss content posted by Megan Beebe insert multiple rows into variable RE: insert multiple rows into variable
Licentiat
SSC Enthusiast
Points: 146
More actions
July 17, 2008 at 6:13 am
#844314
This will give you the string in the right format:
--select all the rows into the variables
select
@Numbers = @Numbers + iNumber,
@Strings=CASE @Strings WHEN '' THEN sNumber ELSE @Strings + ', '+sNumber END
from @demo
Excellent trick.
Nick