Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have written as

create trigget {trigger name
on [table name]
For insert, update, delete
as
begin
EXEC master..xp_cmdshell @strcmdshell Myexe.exe
end




my question is that when i am trying to run EXEC master..xp_cmdshell @strcmdshell Myexe.exe
its working individually but how can i run inside trigger .
in this case trigger is creating successfully but this exe doesnt run on insert.updste,delete .
can anyone help me ?
Posted

1 solution

First of all I warn you: doing such actions leads to unsafe and unstable server's work.
1. Set TRUSWORTHY ON upon desired database
2. Choose WITH PERMISSION_SET = UNSAFE or EXTERNAL_ACCESS
3. Create CLR storing procedure which executes external binaries or uses libs
4. Create CLR trigger which executes CLR stored procedure created

It is not safe at all, so consider not to use this, try to use CLR procedures without executing any external code.
 
Share this answer
 
Comments
Maciej Los 27-May-13 15:45pm    
Agree!
+5
skydger 28-May-13 2:12am    
Thank you :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900