我在SQL创建了一个存储过程,可是不会执行,谁能把执行这个存储过程的代码写出来

来源:百度知道 编辑:UC知道 时间:2024/06/02 15:03:30
create procedure price_proc (
@count int output,
@avg_price money output,
@type char(12)='ip'
)
as select @count=count(*),@avg_price=avg(price)
from titles
where type=@type

表titles:
no name price type
1 a 50 ip
2 s 100 ip
3 q 450 io
4 w 450 ip

数据类型分别是int,char,money,type,长度都是默认
哪位兄台能帮我把执行的代码写下来
PS:你如果在网上复制一大段怎么执行存储过程的文章就别别答了

create procedure price_proc
@count int output,
@avg_price money output,
@type char(12)='ip'
as
begin
select @count=count(*),@avg_price=avg(price)
from titles
where type=@type
end
--
Go
--
declare
@count int ,
@avg_price money
execute price_proc @count,@avg_price,'ip'
select @count,@avg_price
GO

create procedure price_proc
@count int output,
@avg_price money output,
@type char(12)='ip'

as
begin
select @count=count(*),@avg_price=avg(price)
from titles
where type=@type
end