存储过程代码可以正常执行,但是好像不能输出结果,数据并没有插入到表中去
create table Lisan(grade char(40) ,num int)
create procedure L2
as
begin
declare
@0to60 smallint,
@60to70 smallint,
@70to80 smallint,
@80to90 smallint,
@90to100 smallint
select
@0to60 =0,
@60to70 =0,
@70to80 =0,
@80to90 =0,
@90to100 =0
select @0to60 =count(*)
from sc
where grade <=60 and cno='8'
select @60to70 = count(*)
from sc
where grade > 60 and grade <=70 and cno='8'
select @70to80 = count(*)
from sc
where grade > 70 and grade<=80 and cno='8'
select @80to90 = count(*)
from sc
where grade > 80 and grade <= 90 and cno='8'
select @90to100 = count(*)
from sc
where grade>90 and grade<=100 and cno='8'
insert
into Lisan
values('<=60',@0to60)
insert
into Lisan
values('60-70',@60to70)
insert
into Lisan
values('70-80',@70to80)
insert
into Lisan
values('80-90',@80to90)
insert
into Lisan
values('90-100',@90to100)
select '90to100' ,@90to100
select '80to90' ,@90to100
select '70to80' ,@90to100
select '60to70' ,@90to100
select '0to60' ,@90to100
end
go