📄 查找学分的存储过程.txt
字号:
exec sp_help 选课表
select * from 选课表
alter table 选课表
add 学分 int
update 选课表 set 学分=''
select * from 课程表
select * from 选课表
create proc check_xf
as
declare @学生编号 varchar(12),@学分 int,@课程编号 varchar(6),@分数 int
declare cursor_no_xf cursor
for
select 学号,课程号,分数,学分 from 选课表 where 分数>=60 and (学分 is null or 学分=0)
open cursor_no_xf
fetch next from cursor_no_xf into @学生编号,@课程编号,@分数,@学分
while @@FETCH_STATUS = 0
begin
select @学分=学分 from 课程表 where 课程号=@课程编号
update 选课表 set 学分=@学分 where 学号=@学生编号 and 课程号=@课程编号
fetch next from cursor_no_xf into @学生编号,@课程编号,@分数,@学分
end
close cursor_no_xf
deallocate cursor_no_xf
go
drop proc check_xf
exec check_xf
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -