Export to text file for specific row inserted

  • I am looking for a solution to export the sql rows to a text file in a path when the database insert meets particular condition. I need one text file for each row. I don't need a text file for all the rows. Need text file output only when the database insert happens for my condition.

    I understand trigger should not be used to output the text file directly.

  • Unless I'm reading it wrong, sounds like you could use Service Broker for that...

    "Here are some examples of reasons you might use Service Broker:

    Asynchronous triggers. You can construct asynchronous triggers either to a remote server or looping back to the same server. The latter is actually fairly common. A stored procedure or T-SQL command could fire a trigger that queues up another job through Service Broker, which is performed in a separate transaction and divorced entirely from the context of the original job."

    see: https://searchsqlserver.techtarget.com/tip/Service-Broker-in-SQL-Server-How-and-when-to-use-it

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply