Re: How to get a SP return value on another SP?
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Tue, 12 Sep 2006 07:19:54 +0000 (UTC)
Cylix (cylix2000@xxxxxxxxx) writes:
I have a SP, which will exec other SP depend on the input.
the "other SP" need to return a integer back.
How to do this?
You could use an OUTPUT parameter for this.
CREATE PROCEDURE inner_sp @x int OUTPUT AS
SELECT @x = 23
go
CREATE PROCEDURE outer_sp AS
DECLARE @x int
EXEC inner_sp @x OUTPUT
PRINT '@x is ' + ltrim(str(@x))
The trick is that you must specify OUTPUT when you call the procedure as
well.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- Follow-Ups:
- Re: How to get a SP return value on another SP?
- From: Cylix
- Re: How to get a SP return value on another SP?
- References:
- How to get a SP return value on another SP?
- From: Cylix
- How to get a SP return value on another SP?
- Prev by Date: Re: Top and Views
- Next by Date: Re: How to get a SP return value on another SP?
- Previous by thread: Re: How to get a SP return value on another SP?
- Next by thread: Re: How to get a SP return value on another SP?
- Index(es):
Relevant Pages
|