zoukankan      html  css  js  c++  java
  • SQL中游标的用法


    if object_id('##tmp1') is not null
    drop table #tmp1
    select staffno, paydate
    into #tmp1
    from dbo.OSS_ClockingDetail
    where paydate>getdate()-50 and ProcessInd='P' and ActionBy='D' and paymonth is null
    group by staffno,paydate
    declare @staffno varchar(6)
    declare @paydate datetime
    declare cur cursor for select staffno, paydate
    from #tmp1
    open cur
    fetch next from cur into @staffno,@paydate
    WHILE (@@FETCH_STATUS = 0)
    begin
    update dbo.OSS_Rawclocking set intime='',outtime='',payhour=0,offind=0 where paydate=@paydate and staffno=@staffno
    update dbo.OSS_ClockingDetail set ProcessInd='U' where paydate=@paydate and ProcessInd='P' and ActionBy='D' and paymonth is null and staffno=@staffno
    fetch next from cur into @staffno,@paydate
    end
    close cur
    DEALLOCATE cur
  • 相关阅读:
    Java 包装类
    CTF 入门笔记
    Java 实践
    Java Object类
    Java 接口
    Java 抽象类
    Java 关键字final
    Java 多态性
    C#类,对象,类成员简介
    C#初始类和命名空间
  • 原文地址:https://www.cnblogs.com/xiaoyichong/p/10948723.html
Copyright © 2011-2022 走看看