Create procedure ordertotal
@order_total money output
as
begin
select @order_total = sum(item_price*quantity) from oders where .....
end
@order_total定义为OUTPUT,因为要从存储过程返回合计值
调用它:
Declare @order_total money
execute ordertotal @order_total output
select @order_total