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

  • 相关阅读:
    javascript中获取dom元素高度和宽度
    $.ajax()方法详解
    JQ中$(window).load和$(document).ready区别与执行顺序
    第几个幸运数
    乘积尾零
    星期一
    分数
    卡片换位
    冰雹数
    打印方格
  • 原文地址:https://www.cnblogs.com/duanlinlin/p/3305484.html
Copyright © 2011-2022 走看看