简体   繁体   中英

In SQL Server, is the identity value generated/assigned on insert statement execution or on transaction commit?

Some table has an INT column with primary key and identity constraints. When two concurrent transactions are inserting a row into the table, which of the transactions will end up with HIGHER column value, the one that executed INSERT statement later or the one that ended/committed later?

在执行INSERT操作期间正在生成ID,因此在插入(2)之前执行的insert(1)将具有较低的ID(当然,如果增量为正:))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM