Update Trigger ?

  • Sorry to cross post but I have not had any replys (probably because I posted in the wrong forum).

    Problem - I have an order lines table (child) and an order header table (parent). The order header table contains a total field which is the sum of all costs from the order lines table. What is the best way to update the order header table every time the user adds, edits or deletes an order line. Should I create an update, insert and delete trigger on the order line table which updates the order header table? Will this cause locking issues? Is there a better way?

    How should I code the triggers (I am new to triggers)?

    Thanks for any assistance.

    CCB

     

  • where is the option for Triggers in SQL-SERVER 2000 just like sql 7.0 ?/

    i have searched but not find

    <a href="http://www.websolsoftware.com"> For IT jobs click here</a>

    *Sukhoi*[font="Arial Narrow"][/font]

  • Depending on your system set-up TRIGGERs might not be the way to go (They can lock the system up and cause performance issues)

    Why not Add a 2nd line of code into the system that UPDATEs the Header table at the same time that you are U|I|D from the detail table?

    Or couldn't you do this on ORDER submit??  This way it would be done once per order or on PREVIEW ORDER ???

    Good Luck



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

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

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