Home All Groups Group Topic Archive Search About

create a sp from query output

Author
2 Apr 2007 5:54 PM
darrin.wilkinson
Hi,

Is there a way in either SQL server 2000/2005 that would allow me to
create a stored proc from the output of a query?

Eg.

To demonstrate my question lets say I have a script to create a table
and populate the table with sequential numbers from 1 to 100000:

PRINT "Create Procedure usp_Inserts"
PRINT " as"
PRINT "create table T1(C1 int)"
PRINT "insert into T1 values (1)"
PRINT "insert into T1 values (2)"
....
PRINT "insert into T1 values (100000)"


How can I take the output generated by the above script and have the
output executed automatically  to create the stored procedure
usp_Inserts?

Thanks in advance,
Darrin

AddThis Social Bookmark Button