DB is SQL2k.
In a previous posting I raised, thread183-758412, I didn't get any suggestions so decided to go down the Cursor route with some sucess.
I've got the stored procedure which outputs dynamic sql.
The output is simply a series of Select and Union statements. e.g a sanitised version of the output is
using a Print command withing the sp is
Select field1 from table1
union all
Select field2 from table1
union all
Select field3 from table1
union all
(repeated about 200 times)
etc
How can you execute the whole batch of sql in a sp?
each line is upto 600 chars
and having 200 select/union statements is typical.
Thanks
P.S.
If anyone want to suggest a alternative to using cursors maybe you can use the original thread.
In a previous posting I raised, thread183-758412, I didn't get any suggestions so decided to go down the Cursor route with some sucess.
I've got the stored procedure which outputs dynamic sql.
The output is simply a series of Select and Union statements. e.g a sanitised version of the output is
using a Print command withing the sp is
Select field1 from table1
union all
Select field2 from table1
union all
Select field3 from table1
union all
(repeated about 200 times)
etc
How can you execute the whole batch of sql in a sp?
each line is upto 600 chars
and having 200 select/union statements is typical.
Thanks
P.S.
If anyone want to suggest a alternative to using cursors maybe you can use the original thread.