雨
雨林18
Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一个触发事件,我想抓客户端ip,但总是抓不到,请高手帮我看看是那出了问题,谢谢!
此语法再sql server2000里是通过的!!!
CREATE trigger test
on Tygeneralize_basic
for delete
as
declare @ip varchar(20),@hst varchar(20),@sql varchar(100)
declare @str varchar(100)
set @str='PING '+Host_Name()
create table #tmp(aa varchar(200))
insert #tmp exec master..xp_cmdshell @str
select top 1 @ip = replace(left(aa,charindex(':',aa)-1),'Reply from ','') from #tmp where aa like 'reply from %:%'
drop table #tmp
INSERT INTO Tygeneralize_basic_test(Tygeneralize_province,ip) select Tygeneralize_province,(select @ip) as ip from deleted
此语法再sql server2000里是通过的!!!
CREATE trigger test
on Tygeneralize_basic
for delete
as
declare @ip varchar(20),@hst varchar(20),@sql varchar(100)
declare @str varchar(100)
set @str='PING '+Host_Name()
create table #tmp(aa varchar(200))
insert #tmp exec master..xp_cmdshell @str
select top 1 @ip = replace(left(aa,charindex(':',aa)-1),'Reply from ','') from #tmp where aa like 'reply from %:%'
drop table #tmp
INSERT INTO Tygeneralize_basic_test(Tygeneralize_province,ip) select Tygeneralize_province,(select @ip) as ip from deleted