I'm trying to have a batch file execute whenever data is updated in a database. I've found that if I put: cmd.exe /c "c:\test.bat" in a SQL Server Agent job I can execute the batch file, but there doesn't seem to be a way to have this triggered by a record being added, updated, or deleted. Any help on this would be greatly appreciated. Thanks!
I'm generating html code from the new/modified/deleted records and compiling them in to a help desk. I currently have a linked access database checking every 2 seconds for new entries so I feel like anything would be better than that :)
There are other processes running outside of the html generation, including a command line driven compiling. Do you think you could give me an example of what my trigger code would look like? Maybe using Database1 and Table1 having a trigger for any insert, update or delete that would run "c:\test 1.bat" using xp_cmdshell? Also where would this code be put?
what i would suggest is to add a logic inside your trigger to capture the details of records being changed in a table. Then execute a periodic job which will pick up records from first table, do processing of records, and call bet to build html etc