Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Nesting OUTPUTs from Stored Procs

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-26 : 08:31:48
Peter writes "Can someone please explain the correct way to ripple output variables. Thanks.

The following test does not produce the expected results:


drop procedure Test2

go

Create procedure Test2(
@ret_id varchar(255) OUTPUT
)
AS
Begin
Set @ret_id = '999'
print 'Inside Test2 :'
print @ret_id
end

Go

drop procedure Test3

go

Create procedure Test3(
@ret_id varchar(255) OUTPUT
)
AS
Begin
Exec Test2 @ret_id
Set @ret_id = @ret_id + '000'
print 'Inside Test3: '
print @ret_id
end

go

Declare @the_id varchar(255)

Exec Test3 @the_id

print 'The id is : '

print @the_id

Go"
   

- Advertisement -