strangeBrew12
Programmer
I am using a cursor to manipulate my data from individual records to one long string (for reporting purposes). I am using the following:
Exec('DECLARE PM CURSOR FOR SELECT * FROM '+@UserTable99+'')
OPEN PM
FETCH PM INTO @PM8sub
WHILE @@FETCH_STATUS=0
BEGIN
SET @JJ = 'SELECT PopDesc FROM PopUps WHERE Pop# = 30 AND PopChar = '''+@PM8sub+''''
Exec(@JJ)
FETCH NEXT FROM PM INTO @PM8sub
END
CLOSE PM
DEALLOCATE PM
How can I take the single record output by 'Exec(@JJ)' concatinate that with the variable. Basically @JJ + ', ' + @JJ
Thanks
JJ
Exec('DECLARE PM CURSOR FOR SELECT * FROM '+@UserTable99+'')
OPEN PM
FETCH PM INTO @PM8sub
WHILE @@FETCH_STATUS=0
BEGIN
SET @JJ = 'SELECT PopDesc FROM PopUps WHERE Pop# = 30 AND PopChar = '''+@PM8sub+''''
Exec(@JJ)
FETCH NEXT FROM PM INTO @PM8sub
END
CLOSE PM
DEALLOCATE PM
How can I take the single record output by 'Exec(@JJ)' concatinate that with the variable. Basically @JJ + ', ' + @JJ
Thanks
JJ