Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What level does the IDENTITY_VAL_LOCAL Function retrieve?

Status
Not open for further replies.

cjbentley

Programmer
Dec 31, 2004
1
0
0
GB
I cannot find any information that states whether the IDENTITY_VAL_LOCAL function retrieves the latest ID at a table level or at a Unit Of Work level.

This would be done directly after the insert to the parent table to enable the ID to be used as part of a concatenated key in another table.

My worry is that if multiple processes are inserting into the parent table will the correct ID be retrieved by the IDENTITY_VAL_LOCAL function or will it just get the latest ID inserted on to the parent table.
 
My documentation points to the latest ID value for a given user (connection) immediately prior to the commit.
If multiple rows are inserted, the value retrieved is that of the latest single insert.
"When multiple users are inserting into the same table concurrently, each will see their own recent identity column value. They cannot see each others' ."

Quote is based on G. Birchall's SQL documentation....

Ties Blom
Information analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top