give you a sample!create proc test as select productid,productname from products where productid>100 goafter you finished created this procyou can do it as following:declare @result int exec @result=test
create proc proc_orders @orderid int, @quantity int output as select @quantity=quantity from orders where orderid=@orderid goafter creating proc you can do it as the following: declare @orders_quantity int exec proc_orders @orderid='10058', @quantity=@orders_qunatity output select "quantity"=@orders_quantityI think this is the answer you want to get!
give you a sample!create proc test
as
select productid,productname from products where productid>100
goafter you finished created this procyou can do it as following:declare @result int
exec @result=test
@orderid int,
@quantity int output
as
select @quantity=quantity from orders where orderid=@orderid
goafter creating proc
you can do it as the following:
declare @orders_quantity int
exec proc_orders
@orderid='10058',
@quantity=@orders_qunatity output
select "quantity"=@orders_quantityI think this is the answer you want to get!
不过我要是同时想要orderid=n 和orderid=m的结果呢
用一个过程做的,好像我说的有点问题,你们就看着办吧:)