Asked by:
trigger can not run application

Question
-
I want to create a trigger that activates the application, but it doesn't run, the error message: The specified event type (s) is / are not valid on the specified target object.
this code:use test011
go
CREATE TRIGGER Record ON DATABASE
AFTER INSERT
AS
select * from u_RecordAllBEGIN
EXEC master..xp_CMDShell 'C:\testjob.exe';
END
GO
- Edited by om botaxs Saturday, May 30, 2020 5:40 AM
Saturday, May 30, 2020 5:39 AM
All replies
-
Dup on SO. You can't create a DML trigger on a database and trying to start an application within a trigger is likely a doomed approach.
- Proposed as answer by Olaf HelperMVP Friday, June 5, 2020 6:09 AM
Saturday, May 30, 2020 12:09 PM -
Hi Scott
do you have any idea how to run exe file with triggers from sqlserver?
Saturday, May 30, 2020 3:43 PM -
Hi om,
Please try to use below query to create a trigger and check whether it works.
use test011
go
CREATE TRIGGER Record ON u_RecordAllBEGIN
AFTER INSERT
AS
EXEC master..xp_CMDShell 'C:\testjob.exe'
GO
Please also refer below articles for more details about create trigger and xp_cmdshell commands.
Best regards,
Melissa
-------------------------------------------
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com
- Edited by Melissa MaMicrosoft contingent staff Monday, June 1, 2020 2:52 AM
- Proposed as answer by Melissa MaMicrosoft contingent staff Tuesday, June 2, 2020 5:52 AM
Monday, June 1, 2020 2:46 AM -
HI om,
Could you please provide any update about this error?
Please help check whether the provided solution is working or not.Thanks.
Best regards,
Melissa
-------------------------------------------
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com
Friday, June 5, 2020 12:55 AM