Storedprocedures
Can we call one storedprocedure to another storedprocedure.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Syed Nayab AliPosted Nov 4, 2011, 12:50 PM
You can execute a storedprocedure into another storedprocedure.
This is one of the benifits of SP.
But you should know effect or result of inner SP because at the time of execution of outer SP you can't see output of inner SP.
Create procedure SP1
AS
BEGIN
exec SP2
END
Try to use code of SP2 in the body SP1 (if you have and if it is not too much long) because it will save execution time.
Thanks
Please click on "Accepted Answer" if it helps you
Pravin MorePosted Nov 4, 2011, 9:21 AM
yes... you can call like that.....
for e.g:-
Create PROCEDURE [dbo].[testpravinnew]
AS
BEGIN
SET NOCOUNT ON
exec TestPravin param1,param2
END
Thanks,Mark it as "Accepted answer" if it helps you.
Pravin.
Dhaval PatelPosted Nov 4, 2011, 9:19 AM
you are partially correct, sp's can call
another sp but the levels is only upto 32.