触发器是这样写的: ALTER TRIGGER [ST].TRIG_TABLE1_LOG_INSERT ON [ST].TABLE1_TMP AFTER INSERT AS BEGIN declare @HOSTNAME varchar(50) declare @NETADDRESS varchar(50) declare @LOGINNAME varchar(50) declare @LOGINTIME varchar(32) declare @spid varchar(32)
SET NOCOUNT ON; set @spid = (select @@spid) set @HOSTNAME = (select distinct hostname from master..sysprocesses where spid = @spid) set @NETADDRESS = (select distinct net_address from master..sysprocesses where spid = @spid) set @LOGINNAME = (select distinct loginame from master..sysprocesses where spid = @spid) set @LOGINTIME = (select distinct login_time from master..sysprocesses where spid = @spid)