Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Location
    Minneapolis, MN
    Posts
    253

    Unanswered: Identity_val_local

    I just have a general question about identities:

    Is it possible that when doing a SELECT IDENTITY_VAL_LOCAL inside a store procedure, that you could get the wrong identity returned?

    For example, some does an insert into a row with an identity column at precisely the same time someone does an insert into the same table. Could USER A somehow get the identity that was created by USER B , and vice versa?

    Any input would be helpful.

    Thanks
    Anthony Robinson

    "If I'm curt with you, it's because time is a factor here. I think fast, I talk fast, and I need you guys to act fast if you want to get out of this. So, pretty please - with sugar on top..."

  2. #2
    Join Date
    Aug 2004
    Posts
    330
    The IDENTITY_VAL_LOCAL is only available locally within the level at which it was assigned. It is set to null whenever a COMMIT or ROLLBACK of a unit of work occurrred since the most recent INSERT statement of that assigned value. In other words they can't get to each other's values.

Posting Permissions

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