September 30, 2004 at 10:16 am
I want to write select store procedure with 4 columns
Passing a single variable and returning all the 4 columns as an output can someone help me
how to return 4 coulmsn for example:
create proc test
@id int output,
@name char(10) output,
@city char(20) output,
@state char(2) output
as
select id,name,city,state from test_table where id = @id
???????????
September 30, 2004 at 10:33 am
The proc
create proc test
@id int,
@name char(10) output,
@city char(20) output,
@state char(2) output
as
select
@id = id,
@name = name,
@city = city,
@state = state
from test_table where id = @id
To execute:
declare
@id int,
@name char(10),
@city char(20),
@state char(2)
set @id = 5
exec test @id, @name output, @city output, @state output
select @id, @name, @city, @state
-- Steve
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply