database trigger

  • business rule: whenever my c#.net applications insert, update or delete an order, it will also automatically insert an "insert", "update", "delete" status in the status table. My question is would it be better to use stored procedure to handle this or can I utilize database trigger for this? Thanks for all the help.

  • A trigger would be better as that would also help you to track if somebody has inserted, updated or deleted an Order from outside your C# Application.


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Thanks Kingston. So do I need to create an after insert trigger on the orders table and that trigger would automatically insert a status in the status table?

  • You can create a single trigger for all three operations( INSERT, UPDATE and DELETE )

    Inside the trigger you will have write programming logic to INSERT values in Status table based on whichever operation( INSERT or UPDATE or DELETE ) has happened.


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

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

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