请教如何写,表插入一条记录触发一个预先定义好的存储过程
请教如何写,表插入一条记录触发一个预先定义好的存储过程,谢谢! 触发器里写执行存储过程。SET QUOTED_IDENTIFIER ON
GO
create TRIGGER .
ON.[**]
AFTER DELETE
AS
BEGIN
declare @client_ip varchar(20)
declare @client_name varchar(20)
declare @client_time datetime
--连接ip和机器名
select @client_ip = a.client_net_address, @client_name = b.host_name, @client_time =GETDATE()
from Sys.dm_exec_connections a, Sys.dm_exec_Sessions b
where a.session_id = b.session_id and a.session_id = @@spid
insert into *_LOG
select *, @client_ip, @client_name, @client_time
from deleted
END
页:
[1]