Results 1 to 4 of 4

Thread: Identity of an Updated Record

  1. #1
    Jody Guest

    Identity of an Updated Record

    Does anyone know how to get the indentity of the last updated record in a table. I need it for a cascading trigger.

    Thank you,

    Jody

  2. #2
    Ray Miao Guest

    Identity of an Updated Record (reply)

    Try 'select @@identity'.


    ------------
    Jody at 11/15/2001 10:25:06 PM

    Does anyone know how to get the indentity of the last updated record in a table. I need it for a cascading trigger.

    Thank you,

    Jody

  3. #3
    Jody Guest

    Identity of an Updated Record (reply)

    No. That gives me the identity of the last record added in the table. I need to know who is updated every time the table is changed.

    j


    ------------
    Ray Miao at 11/16/2001 9:30:47 AM

    Try 'select @@identity'.


    ------------
    Jody at 11/15/2001 10:25:06 PM

    Does anyone know how to get the indentity of the last updated record in a table. I need it for a cascading trigger.

    Thank you,

    Jody

  4. #4
    David Westmore Guest

    Identity of an Updated Record (reply)

    I'm not absolutely certain that I understand your situation, but I think that what you should be doing is to look at the "inserted" virtual table inside the trigger.

    This can be used for any INSERT or UPDATE trigger to control the exact contents of any field in the inserted or updated record. THe only doubt I have is how an identity field works (the problem is that while you are in the trigger, I think you are still in a state which is prior to the commit of the transaction)...

    There is also a "deleted" virtual table you can use to look at the record BEFORE the update (e.g. if you need to detect whethere particular fields have been changed).

    SQL2000 can do cascading updates automatically (like Access), although obviously within a trigger you can have much more control over the whole process.

    Regards

    David Westmore



    ------------
    Jody at 11/15/2001 10:25:06 PM

    Does anyone know how to get the indentity of the last updated record in a table. I need it for a cascading trigger.

    Thank you,

    Jody

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •