• 系统 触发器


    USE [jiFen ]
    GO
    /****** Object: Trigger [dbo].[trigger_EmpInfo] Script Date: 03/21/2016 17:26:24 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    --触发器
    ALTER TRIGGER [dbo].[trigger_EmpInfo] ON [dbo].[EmpInfo]
    AFTER UPDATE
    AS
    DECLARE @t TABLE
    (
    eventtype NVARCHAR(500) ,
    prama SMALLINT ,
    eventinfo NVARCHAR(MAX)
    )

    INSERT  INTO @t  
            ( eventtype ,  
              prama ,  
              eventinfo  
            )  
            EXEC ( 'DBCC INPUTBUFFER(' + @@spid + ')'  
                )  
    
    INSERT  INTO jfEmpinfoUpdate  
            SELECT  @@SPID ,  
                    'UPDATE' ,  
                    ( SELECT  top 1  eventinfo  
                      FROM      @t  
                    ) ,  
                    ( SELECT top 1  connect_time  
                      FROM      sys.dm_exec_connections  
                      WHERE     session_id = @@spid  
                    ) ,  
                    ( SELECT   top 1  net_transport  
                      FROM      sys.dm_exec_connections  
                      WHERE     session_id = @@spid  
                    ) ,  
                    ( SELECT   top 1  protocol_type  
                      FROM      sys.dm_exec_connections  
                      WHERE     session_id = @@spid  
                    ) ,  
                    ( SELECT   top 1  auth_scheme  
                      FROM      sys.dm_exec_connections  
                      WHERE     session_id = @@spid  
                    ) ,  
                    ( SELECT   top 1  client_net_address  
                      FROM      sys.dm_exec_connections  
                      WHERE     session_id = @@spid  
                    ) ,  
                    ( SELECT    top 1 client_tcp_port  
                      FROM      sys.dm_exec_connections  
                      WHERE     session_id = @@spid  
                    ) ,  
                    ( SELECT    top 1 local_net_address  
                      FROM      sys.dm_exec_connections  
                      WHERE     session_id = @@spid  
                    ) ,  
                    ( SELECT    top 1 local_tcp_port  
                      FROM      sys.dm_exec_connections  
                      WHERE     session_id = @@spid  
                    ) ,  
                    ( SELECT    top 1 [host_name]  
                      FROM      sys.dm_exec_sessions  
                      WHERE     session_id = @@spid  
                    ) ,  
                    ( SELECT   top 1  [program_name]  
                      FROM      sys.dm_exec_sessions  
                      WHERE     session_id = @@spid  
                    ) ,  
                    ( SELECT   top 1  host_process_id  
                      FROM      sys.dm_exec_sessions  
                      WHERE     session_id = @@spid  
                    ) ,  
                    ( SELECT   top 1  client_interface_name  
                      FROM      sys.dm_exec_sessions  
                      WHERE     session_id = @@spid  
                    ) ,  
                    GETDATE()
  • 相关阅读:
    MAC上Vue的一些安装及配置
    MySQL
    git
    win7系统的用户怎么去掉用户账户控制?
    JS
    IDEA使用总结
    Mybatis
    codeforces cf educatonal round 57(div2) D. Easy Problem
    codeforces round#509(div2) E. Tree Reconstruction
    codeforces round#509(div2) D. Glider
  • 原文地址:https://www.cnblogs.com/VictorBlog/p/5302968.html
Copyright © 2020-2023  润新知