查找学分的存储过程.txt

来自「图书管理系统 按书本上写的编辑的」· 文本 代码 · 共 26 行

TXT
26
字号
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 + =
减小字号Ctrl + -
显示快捷键?