返回顶部
首页 > 资讯 > 数据库 >定时注销电子签核用户
  • 610
分享到

定时注销电子签核用户

2024-04-02 19:04:59 610人浏览 泡泡鱼
摘要

USE [EFNETSYS] Go SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[SP_Dz] (

USE [EFNETSYS]
Go

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_Dz]
(
    @注销时间 int = 360
) 
AS
BEGIN
    SET NOCOUNT ON;      
--------------------------------------------------------------
if object_id('tempdb..#TempA') is not null drop table #TempA; 
--------------------------------------------------------------
 DECLARE @Time nchar(20) = replace(Convert(nchar(20),GETDATE(),120),'-','/')
 DECLARE @Run_Time_ss int , @XUHAO  varchar(8)
 set @Run_Time_ss =   Convert(int,substring(@Time,18,2))
                    + Convert(int,substring(@Time,15,2)) * 60
                    + Convert(int,substring(@Time,12,2)) * 360 
select * into #TempA from 
(
select 
   ROW_NUMBER() OVER (ORDER BY @XUHAO  ASC) AS '序号'
   ,* 
from 
(
select 
    ZZ001 as 登录者
    ,ZY002 as 起始时间
    ,@Time as 当前时间
    ,@Run_Time_ss - 
        ( Convert(int,substring(ZY002,18,2))
        + Convert(int,substring(ZY002,15,2)) * 60
        + Convert(int,substring(ZY002,12,2)) * 360) as 运行时间
    ,ZZ004 from EFNETSYS.dbo.CRMZZ
left join EFNETSYS.dbo.CRMZY
on ZZ001 = ZY001 and ZZ004 = ZY004 ) as A
where 运行时间 > @注销时间
) as B
---------------------------------------------------------------
DECLARE  @i int = 1
        ,@rows int = (select COUNT(*) from #TempA)
        ,@ZZ004 nchar(20)
if @rows <> 0
begin
    while @i <= @rows
    begin
        select @ZZ004 = ZZ004 from #TempA where 序号 = @i
        delete from EFNETSYS..CRMZZ where ZZ004 = @ZZ004
        set @i = @i + 1
    end
end
drop table #TempA
---------------------------------------------------------------
End

GO
您可能感兴趣的文档:

--结束END--

本文标题: 定时注销电子签核用户

本文链接: https://lsjlt.com/news/41108.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作