开发者

How to create a stored procedure within another stored procedure in SQL Server 2008

I want to create a stored procedure to be used within a stored procedure something like shown be开发者_运维百科low. Is this possible?

CREATE procedure parentSP
as 

--child SP definition.
CREATE procedure childSP1 @inputArg varchar(50)
as 
--do something.
Go

--call child sp within parentSP
execute childSP1 '10'

Go


You can use exec:

CREATE procedure parentSP
as 
exec('CREATE procedure childSP1 @inputArg varchar(50)
as 
--do something.')

--call child sp within parentSP
execute childSP1 '10'
Go
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜