>It's really hard to explain.
>Hope the example helps
I think I understand but my solution still holds. You can still combine multiple variables when you go to execute the query. You'll just have to be creative when it comes to building the string.
DECLARE @cmd1 nvarchar(4000), @cmd2 nvarchar(4000), @cmd3 nvarchar(3000)
DECLARE @worker nvarchar(4000), @cntr int
SET @cntr = 1
DO WHILE (something)
BEGIN
SET @worker = @worker + {new part of the query}
IF (len(@worker) > 3500)
BEGIN
IF @cntr = 1 SET @cmd1 = @worker
IF @cntr = 2 SET @cmd2 = @worker
IF @cntr = 3 SET @cmd3 = @worker
SET @worker = ''
END
...
END
EXECUTE (@cmd1 + @cmd2 + @cmd3)
Or something similar.
-Mike