By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,567 Members | 1,670 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,567 IT Pros & Developers. It's quick & easy.

Execute a batch file using sql server

P: 1
I have a bat file which execute the Pentaho kettle job whenever my source update.

so in sql server i create a trigger whenever my source update.
I used this command,

Expand|Select|Wrap|Line Numbers
  1. CREATE TRIGGER dbo.job_trigger 
  2.    ON  dbo.test 
  3.    AFTER INSERT,DELETE,UPDATE
  4. AS 
  5. BEGIN
  6.     -- SET NOCOUNT ON added to prevent extra result sets from
  7.     EXEC master..xp_CMDShell 'C:\testjob.bat';
  8.  
  9.     -- Insert statements for trigger here
  10. END
  11. GO
whenever I insert a new record it goes in infinite loop.


Please help who can I execute the batch file using trigger.
Aug 9 '13 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,430
Your batch files is probably doing something to cause an infinite loop. It's probably inserting a record into the test table which triggers job_trigger. But that's a guess because you haven't told us what the batch file does.
Aug 9 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.