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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return value stored procedure 1

Status
Not open for further replies.

Naoise

Programmer
Dec 23, 2004
318
IE
Without explicitly passing something in the arg list of a procedure how can you access a RETURN value, for example

Code:
create sp1
as
begin

if exists (select foo from foobar)
     begin
         return 1
     end
else
     begin
         return 0
     end

end
go

create procedure sp2
as
begin

declare @foo int

  set @foo = exec sp1

end 
go

I say this as I have a situation where I am using a lot of stored procedures that return values like this and I do not want to have to edit them to add another value to each arg list.
 
Cheers, exactly what I was looking for.
 
I have to say I don't understand. In the original post you showed exactly how to access return values. Then, you said ca8msm's answer was exactly what you're looking for, only you will have to add another value to each argument list to implement OUTPUT variables, which you said you don't want!

What is going on?

[COLOR=black #d0d0d0]When I walk, I sometimes bump into things. I am closing my eyes so that the room will be empty.[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top