zoukankan      html  css  js  c++  java
  • Sql游标的使用

    Create Proc sp_Cursor
    (
     nvarchar(50) @GPGENNo
    )
    as
    Declare @ErrorCode nvarchar(MAX)
    begin Tran

    ---- 例子
              declare @TaskDate datetime

              declare @Id int
              declare @cur cursor
              set @cur=cursor for select TaskDate,Id   from #Temp1 Order By TaskDate
              open @cur
              fetch next from @cur into @TaskDate,@Id
              while @@fetch_status=0
              begin


                    Update TableName1 Set TaskDate=@TaskDate  Where Id=@Id    

                  
                    fetch next from @cur into @TaskDate  , @Id
              end
              close @cur
              deallocate @cur


      if @@error<>0 goto Err
     
      Drop Table #Temp1


    Commit Tran
    return
    Err:
        select @ErrorCode as ErrorCode
        rollback tran
        return

  • 相关阅读:
    服务器错误日志
    IfcCurveBoundedSurface
    Ifc发展历史与版本介绍
    IfcCurveBoundedPlane
    IfcRationalBSplineSurfaceWithKnots
    IfcBSplineSurfaceWithKnots
    QDateTime QString
    IFC4 标准中的流程实体
    IFC 标准的定义
    MultipartFile
  • 原文地址:https://www.cnblogs.com/Gxiaopan/p/4183916.html
Copyright © 2011-2022 走看看