Need help with triggers (I think)

  • From your experience on the system can you specify if both master and detail tables are getting inserted in the same transaction boundaries? Triggers are realtime solution but you may want to be more specific on what you want to save.

    Prasad Bhogadi
    www.inforaise.com

  • I would advise not using a trigger for this because if the trigger fails, the transaction that fired it will be rolled back. You don't want to hear that your trigger has been cancelling orders!!!

    Triggers are fired after the insert/update/delete or instead of insert/update/delete. They can not be fired before the insert/update/delete. I think what you are thinking of is that the DML action has not yet been committed. It has been inserted/updated/deleted, just not committed. Meaning it will be rolled back if the trigger fails (un-inserted/un-updated/undeleted).

    If you want it more real time, then schedule the process to run more frequently, like every 15 seconds or so.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

  • Do you really need to have it in another table?  Rather than have redundant data, why not just define a view on the two tables you have no control over, and use the view as the source for whatever other processing/reporting you are doing. 


    Have Fun!
    Ronzo

Viewing 3 posts - 1 through 4 (of 4 total)

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