zoukankan      html  css  js  c++  java
  • 简单实用游标更改数据

    alter proc updateStudent
    @id int,
    @id2 int
    as
    declare @SchoolID int
    declare @ClassID int
    declare @StudentID int
    declare @IDNumber int
    declare @IDAAA int
    begin
    declare FeeInsertStudent cursor for 
    select stuID,SchID,ClasID from T_School where ID=@id
    open FeeInsertStudent 
    fetch next from FeeInsertStudent into @SchoolID,@ClassID,@StudentID
    while @@FETCH_STATUS=0
    begin
    set @IDNumber=(select count(*) from T_LeaveSchool where StudentID=@StudentID and SchoolID=@SchoolID and ClassId=@ClassID)
    set @IDAAA=(select COUNT(*) from T_LeaveSchool where ID=@id2)
    if(@IDNumber!=0)
    if(@IDAAA!=0)
    begin
    update T_LeaveSchool set StudentID=@StudentID,ClassID=@ClassID,SchoolID=@StudentID where ID=@id2
    end
    fetch  next from FeeInsertStudent into @SchoolID,@ClassID,@StudentID
    end
    close FeeInsertStudent
    deallocate FeeInsertStudent


    end

  • 相关阅读:
    Python 写文件
    Python 读文件
    Python 打开文件(File Open)
    Python 异常处理(Try...Except)
    Python PIP包管理器
    Python 正则表达式(RegEx)
    Python JSON
    Python 模块
    Python 迭代器(Iterator)
    Python 继承
  • 原文地址:https://www.cnblogs.com/keanuyaoo/p/3306466.html
Copyright © 2011-2022 走看看