Storedprocedures
Can we call one storedprocedure to another storedprocedure.
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dhaval PatelRank #1,023 · 1.9K reputationPosted Nov 4, 2011, 5:19 AM EDT
you are partially correct, sp's can call
another sp but the levels is only upto 32.
Pravin MoreRank #1,419 · 1.2K reputationPosted Nov 4, 2011, 5:21 AM EDT
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.
Syed Nayab Ali33 reputationPosted Nov 4, 2011, 8:50 AM EDT
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