[thelist] MSSQL: dynamic SQL

Brian Cummiskey Brian at hondaswap.com
Tue Jul 26 14:34:24 CDT 2005


I just wrote a huge query with temp tables, updates and all.

I go to run it, and i'm getting syntax errors.  odd...  everything looks 
right on that line.

so, instead of exec(@query), I select @query

Turns out, its getting chopped.

@query is declared as varchar(8000).  it doesn't go any higher than that.

What can i do?

I can't split it, because its one big insert:
Insert into #temptable select all the conditional stuff here

any ideas?

thx.



More information about the thelist mailing list