How To write before Trigger in sql server 2005

  • Hi All,

    i am using sql server 2005

    i am mainiting the History of my table

    so

    before update record how to insert the record in history table

    two table have same columns

    using trigger

    please help meeeeeeeeeeeeeeeeeee..........

    yours

    pole.

  • This will give you a bit more information on triggers

    http://www.sqlservercentral.com/articles/Triggers/64214/

    this link basically shows you all the content on this site about triggers, and you can watch videos which give you more insight as well.

    http://www.sqlservercentral.com/tags/Triggers

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • You have two virtual tables available in triggers, deleted and inserted. inserted is valid for INSERT and UPDATE triggers, and deleted is valid for UPDATE and DELETE triggers.

    deleted holds the values of the rowS before the update.

    I used a capital S because you should not write the trigger such that it assumes only one row has changed. If you do it will make baby jesus cry.

    Atlantis Interactive - SQL Server Tools
    My blog[/url]
    Why I wrote a sql query analyzer clone

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

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