williamminor
SSCommitted
Points: 1664
More actions
May 8, 2007 at 3:01 pm
#176336
I need to create a SQLSTRING that builds while it cycles through a cursor.
I have this
@SQLSTRING = + Colums1 +','
I need it to give me something like this
@SQLSTRING = Column1, Column1, Column1... Until I cycle through the cursor.
Thanks
_WM
Lynn Pettis
SSC Guru
Points: 442467
May 8, 2007 at 3:55 pm
#705095
You don't need a cursor:
declare @SQLString varchar(max)
select @SQLString = isnull(@SQLString,'') + Column1 + ',' from myTable
set @SQLString = substring(@SQLString, 1, len(@SQLString) - 1)
select @SQLString
May 8, 2007 at 3:57 pm
#705096
thanks
-WM
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply