How to get the last inserted row number with in a trigger

  • Hi Guys,

    I got a problem with my insert trigger today.I have an insert trigger on a table which inserts the records into another server.But now I want to know the newly inserted row number on that server/table within that trigger and need to assign that number to a column in the original(primary) table.

    I think you got my point.

    Anyone,Please help me in this regard...

    Lots of Thanks in advance,

    S.

  • You can get the value from the inserted table.

  • But now I want to know the newly inserted row number

    ...and, if you're smart, you'll make the trigger code handle more than 1 row at a time. 😉

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

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

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