Create a Stored Procedure
How can I create a stored procedure that creates several stored procedures.
Any help or reference will be usefull
Thanks
Networks
How can I create a stored procedure that creates several stored procedures.
Any help or reference will be usefull
Thanks
Here is a handy site :
http://insidesqlserver.com
=)
by logan2001x
by chrandrob
You need to build the stored procedure(s) that will be created as a text string and then execute it. Below is a sample stored procedure (named ProcMaker) that will create 10 other stored procedures named ProcMaker1 through ProcMaker10 when executed:
CREATE PROCEDURE dbo.ProcMaker AS
Declare @SQL varchar(1000),
@ProcNum int
Set @ProcNum = 0
While @ProcNum < 10
BEGIN
Set @ProcNum = @ProcNum + 1
Set @SQL = 'Create Procedure dbo.ProcMaker' + Cast(@ProcNum AS varchar) + ' AS'
Exec(@SQL)
END
by logan2001x
by logan2001x
This discussion is closed to new replies.
Sort by Trending