in my dynamic sql, i have a while loop, after i loop through a table, and then append the variable as result, here is my code
DECLARE @sqlmiddle NVARCHAR(MAX)
DECLARE @loop2 INT = 1
WHILE (@loop2 < = (Select count(*) from #SomeTable))
set @sqlmiddle = @sqlmiddle + somethingINTable
SELECT @loop2 = @loop2 + 1
how come it seems the @sqlmiddle not adding up, is my sytnax wrong?