executing a program in a trigger in MS SQL Server


Is it possible to execute a program (win32) from a trigger?  I want to do some external work after 10 records have been inserted in a table.

Who is Participating?
dodge20Connect With a Mentor Commented:
You should be able to run an xp_cmdshell in your trigger to execute your program.


You may have to enable it if it isn't enabled.
Raja Jegan RSQL Server DBA & ArchitectCommented:
Yes, you can configure xp_cmdshell as mentioned earlier but wont recommend to do so as you might land in some issues..
Having Triggers would impact performance and Calling external program using xp_cmdshell via triggers might add upon to that..

Take care while referencing it..
If possible do it via alternate logics instead of this approach.( recommended)
Anthony PerkinsCommented:
>>Is it possible to execute a program (win32) from a trigger?<<
Can you do it?  Yes.  Should you do it? No.  This is a very bad idea.
soozhAuthor Commented:
well if it is such a bad idea can a some code in a stored procedure execute a stored procedure in another database (same server).
Anthony PerkinsCommented:
I am sorry, I am not understanding you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.