• sanjeev_krs2004 (9/1/2008)


    Hi,

    I have two tables namely account and invoice.

    I want to update one field in account table when there is A NEW RECORD inserted in invoice table. I want to use only triggers nothing else.

    Thanks

    If this is your most optimal way, I cannot tell, but if you insist on using a trigger...

    Create trigger utr_I_Invoice on dbo.invoice

    for insert

    as

    update A

    set yourcol=yourcol + whatever

    from dbo.account A

    inner join inserted I

    on A.account_id = I.Invoice_Account_Id

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me