Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read return code from stored procedure

Status
Not open for further replies.

Lera

Programmer
Jun 20, 2002
1
US
Hello,
I need to be able to read the code my stored procedure returns.Here is an example of the stored procedure that can return 1, 2, 3, etc depending on input parameter. How can I get the value this stpred procedure returns in ASP?
I tried to use Parameters, but couldn't make it work


Here is sp:
CREATE PROCEDURE Test @Value int
AS
IF @Value = 1
BEGIN
RETURN 1
END

IF @Value = 2
BEGIN
RETURN 2
END

IF @Value = 3
BEGIN
RETURN 3
END

IF @Value NOT BETWEEN 1 AND 3
BEGIN
SELECT 'TEST'
END
GO

I'll appreciate if somebody can help me with it.

Thank you
 
Try this...
Code:
CREATE PROCEDURE Test @Value int
AS
IF @Value = 1
    BEGIN
        SELECT 1
END

IF @Value = 2
    BEGIN
        SELECT 2
END

IF @Value = 3
    BEGIN
        SELECT 3
END

IF @Value NOT BETWEEN 1 AND 3
    BEGIN
        SELECT 'TEST'
END

HTH, MapMan [americanflag]

Assume nothing, question everything, be explicit not implicit, and you'll always be covered.
 
Try this, I am sure it will work.

CREATE PROCEDURE Test
@Value int,
@retVal int output
AS

IF @Value = 1
BEGIN
Set @retval = 1
RETURN
END

IF @Value = 2
BEGIN
Set @retval = 2
RETURN
END

IF @Value = 3
BEGIN
Set @retval = 3
RETURN
END

IF @Value NOT BETWEEN 1 AND 3
BEGIN
SELECT 'TEST'
END

GO



--Lopa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top