We help IT Professionals succeed at work.

Getting a return value when calling a stored procedure

181 Views
Last Modified: 2010-03-19
Dear Experts,

I'm calling a stored procedure from within a stored procedure and need to get the return value.

I'm calling EXEC CreateCompany @Company_Name, @EmployeeNo_ID, @Creator, @Created

within CreateCompany I do this to get the new ID...

SELECT @@IDENTITY
Return @@IDENTITY

How can I use this value in my original stored procedure?

Any help would be appreciated.

Thanks

NIck
Comment
Watch Question

Database Consultant
CERTIFIED EXPERT
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
AneeshDatabase Consultant
CERTIFIED EXPERT
Top Expert 2009

Commented:
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.