Accessing RETURN values from a Stored Procedure

  • Thread starter Thread starter PeteZ
  • Start date Start date
P

PeteZ

I can access results returned from a stored procedure call OK, my question
is how do you access the value from a RETURN statement in a stored procedure
?

eg. In the Example below - how can I check on the Value -1000 (Customer
not found) ?

@CID = customer id . . . .


-- Does Customer Exist ?
IF NOT EXISTS (SELECT 1 FROM Customers (NOLOCK) WHERE CID = @CID)
RETURN -1000

- Customer Exists, pass back values
SELECT FirstName, LastName FROM Customers WHERE CID = @CID

RETURN 0


thanks,

- peteZ
 
PeteZ said:
I can access results returned from a stored procedure call OK, my question
is how do you access the value from a RETURN statement in a stored procedure
?

eg. In the Example below - how can I check on the Value -1000 (Customer
not found) ?

@CID = customer id . . . .


-- Does Customer Exist ?
IF NOT EXISTS (SELECT 1 FROM Customers (NOLOCK) WHERE CID = @CID)
RETURN -1000

- Customer Exists, pass back values
SELECT FirstName, LastName FROM Customers WHERE CID = @CID

RETURN 0


thanks,

- peteZ
 
Back
Top