Home Forums SQL Server 2008 T-SQL (SS2K8) trigger to call a program to write a text file onto a folder in the server RE: trigger to call a program to write a text file onto a folder in the server

  • Don't have the trigger do this. Have the trigger insert the data you want to write out to a new table. Use a date, clear the table, something, but store this. Then have a process pull data out of the table (all or certain rows) and write the text file. You can certainly have a process kicked off by the trigger (sp_start_job) or one that polls and looks for change. You could even insert the data into a Service Broker Queue and have an activation proc that writes it out. That's more complex, but it works.

    Decouple this so that problems with the output process (rights, full disk, etc) don't wreck the process that will fire the trigger.