[英]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. 某些表具有
INT
列,其中包含主键和标识约束。 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语句的行还是稍后结束/提交的那个?
在执行INSERT操作期间正在生成ID,因此在插入(2)之前执行的insert(1)将具有较低的ID(当然,如果增量为正:))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.