Sql Server触发器调用exe程序
先在Sql Server中添加启动,需要手动启动(我用的是2019)
-- 启用 xp_cmdshell EXEC sp_configure 'show advanced options', 1 RECONFIGURE EXEC sp_configure 'xp_cmdshell', 1 RECONFIGURE
--- 执行过程 EXEC xp_cmdshell 'D:\bin\Debug\net8.0\DownloadImg.exe'
创建触发器
CREATE TRIGGER InsertIMG on SystemLog AFTER INSERT AS BEGIN EXEC xp_cmdshell 'D:\bin\Debug\net8.0\DownloadImg.exe' END
插入数据之后触发,亲测确实是触发了,但最后一条数据没有到想要的结果中,待补充........
insert into SystemLog (Date ,thread) values(GETDATE(),'https://q8.itc.cn/q_70/images03/20240421/e0a5f758921840449f1561e206243211.jpeg')
标签:exe,cmdshell,EXEC,Server,Sql,xp From: https://www.cnblogs.com/youmingkuang/p/18204662