• tochaturvedi (10/14/2008)


    Hi Gail,

    Thanks for the reply.

    I know that the above trigger will fire after insert action to the sometable and insert the records to someothertable.

    Just the one column.

    You used the statement

    Select somecolumn from inserted.

    What is this inserted? Can i use the sometable inplace of inserted?

    inserted and deleted are pseudo tables visible only within triggers. The inserted table will contain the rows affected by an insert or the new values of rows affected by an update. The deleted table contains rows affected by the delete or the old values of rows affected by an update.

    You can use sometable, but then you'll get all the rows in that table. With inserted, you just get the rows that were inserted by the statement that fired the trigger.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass