• 系统 触发器


    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()
  • 相关阅读:
    android.os.NetworkOnMainThreadException的解决方案
    一些LinuxC的小知识点(一)
    一些LinuxC的小知识点(二)
    <assert.h>库学习
    <string.h>的学习
    Java异常的中断和恢复
    Java Collection或Map的同步
    Java经典实例:按字符颠倒字符串
    Java 经典实例: Unicode字符和String之间的转换
    Java经典实例:处理单个字符串
  • 原文地址:https://www.cnblogs.com/VictorBlog/p/5302968.html
Copyright © 2020-2023  润新知