May 8, 2007 at 3:01 pm
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
May 8, 2007 at 3:55 pm
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
thanks
-WM
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy