Click here to Skip to main content
16,004,678 members
Please Sign up or sign in to vote.
1.50/5 (4 votes)
See more:
This queastion asked in my interview
Posted
Comments
Richard C Bishop 3-Feb-14 10:14am    
Try researching it by entering that phrase into a search engine.

For nested stored procedures - try Nesting Stored Procedures[^].
 
Share this answer
 
v2
 
Share this answer
 
I am giving few steps to achieve goal.

1. Create a stored procedure for addition two number

SQL
CREATE Procedure Proc_AdditionTwoNumber
(
	@first int,
	@second int
)

AS
Begin
declare @add int
SET @add= @first + @second
SELECT @add
end


2. Create another stored procedure that will call first one using exec statement

SQL
CREATE Procedure [dbo].[proc_AddTwoNumber]
(
    @first int,
    @second int
)
AS
exec  Proc_AdditionTwoNumber @first,@second


3. call second stored procedure to get result

SQL
exec proc_AddTwoNumber 12,30
 
Share this answer
 
Use Exec statement inside the calling SP and supply parameters if any, to execute a Stored Procedure in another .

Refer

sql-server-pass-one-stored-procedures-result-as-another-stored-procedures-parameter/[^]

calling-stored-procedure-from-another-stored-procedure-sql-server[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900