Groups | Blog | Home
all groups > sql server new users > november 2005 >

sql server new users : passing values



Andrew J. Kelly
11/17/2005 10:54:46 AM
While this is for sp_executesql it does show the proper syntax for using an
output parameter. The key is to declare it as OUTPUT.

http://www.support.microsoft.com/?id=262499

--
Andrew J. Kelly SQL MVP


[quoted text, click to view]

David Kennedy
11/17/2005 1:38:32 PM
Hi,
Any help would be greatly appreciated
Can anyone give me a detailed example?,I cant get this to work

I have stored procedureA which has one input and one output variables.
I also have stored procedureB which takes in the value of the output
variable from stored procedureA and performs a task on this value.

how do I pass values between stored procedures?

Thanks in advance
David Kennedy

mark sullivan
11/19/2005 11:12:17 PM
-- Create the procedures in tempdb
use tempdb
go
create procedure usp_part1 (@i int, @j int output)
as
begin
select @j = @i + 1
end
go
create procedure usp_part2 (@k int)
as
begin
select @k
end
go

-- Now the example

declare @a int, @b int
set @a = 42
execute usp_part1 @a, @b output
execute usp_part2 @b


Hope this helps,

Mark

[quoted text, click to view]

AddThis Social Bookmark Button