Calling Stored Proc from other Stored Proc 
Author Message
 Calling Stored Proc from other Stored Proc
Hi All,
I have a question to ask.
I have 2 Stored Proc : Proc1 and Proc2.
I want to called Proc2 from inside Proc1.
And I want to get some return value from Proc2 that I can processed from
inside Proc1.
Does anybody know how to do this?

Thank you very much for your help.
Best Regards,
Deili Tan



Mon, 22 Nov 2004 01:52:04 GMT
 Calling Stored Proc from other Stored Proc

Something like this?

CREATE PROC Proc1

AS
BEGIN



END
GO

- Anith


Quote:
> Hi All,
> I have a question to ask.
> I have 2 Stored Proc : Proc1 and Proc2.
> I want to called Proc2 from inside Proc1.
> And I want to get some return value from Proc2 that I can processed from
> inside Proc1.
> Does anybody know how to do this?

> Thank you very much for your help.
> Best Regards,
> Deili Tan



Mon, 22 Nov 2004 02:14:02 GMT
 Calling Stored Proc from other Stored Proc
Deili,

You have to use OUTPUT parameter.

See this example...

--Creating stor proc dbo.proc1

AS

GO

--Using dbo.stor1 inside another stor proc dbo.proc2

AS
DECLARE



GO

--mode of execution
EXECUTE dbo.proc2 10

Dinesh.
--
---
SQL Server FAQ at
www.tkdinesh.com


Quote:
> Hi All,
> I have a question to ask.
> I have 2 Stored Proc : Proc1 and Proc2.
> I want to called Proc2 from inside Proc1.
> And I want to get some return value from Proc2 that I can processed from
> inside Proc1.
> Does anybody know how to do this?

> Thank you very much for your help.
> Best Regards,
> Deili Tan



Mon, 22 Nov 2004 02:09:22 GMT
 Calling Stored Proc from other Stored Proc
If it is a result set then you can create a temp table in proc1 and use:
INSERT INTO #Temp EXEC proc2.  If it is just a single value you can use
OUTPUT parameters.  See BOL for more info.

--
Andrew J. Kelly   SQL MVP
Targitinteractive, Inc.


Quote:
> Hi All,
> I have a question to ask.
> I have 2 Stored Proc : Proc1 and Proc2.
> I want to called Proc2 from inside Proc1.
> And I want to get some return value from Proc2 that I can processed from
> inside Proc1.
> Does anybody know how to do this?

> Thank you very much for your help.
> Best Regards,
> Deili Tan



Mon, 22 Nov 2004 02:10:12 GMT
 Calling Stored Proc from other Stored Proc
Thanks Anith,
that's what I'm looking for.
Thank you very much for your help.

Best Regards,
Deili

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Tue, 23 Nov 2004 10:13:55 GMT
 
 [ 5 post ] 

 Relevant Pages 

1. Stored Proc Calling Another Stored Proc

2. How to call a stored Proc or Ext Stored proc /T-SQL UDF from VBScript

3. calling stored proc from stored proc via variable

4. Calling a stored proc within a stored proc

5. a stored proc calling another stored proc

6. Calling another stored proc within a stored proc

7. Using a stored proc to call another stored proc

8. Calling a Stored proc within a stored proc

9. Calling Stored Proc from another Stored Proc

10. Calling stored proc from stored proc

11. Need Help on Dynamic Stored Proc Call within Stored Proc w/OUTPUT

12. Saving the resultset from a stored proc being called in another stored proc


 
Powered by phpBB® Forum Software