Posted by Erland Sommarskog on 09/12/06 07:19
Cylix (cylix2000@gmail.com) 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@sommarskog.se
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
Navigation:
[Reply to this message]
|