Accessing RETURN values from a Stored Procedure

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
 
P

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top