Does SQL Server guarantee sequential inserting of an identity column?
Posted
by balpha
on Stack Overflow
See other posts from Stack Overflow
or by balpha
Published on 2010-05-13T17:34:50Z
Indexed on
2010/05/13
17:44 UTC
Read the original article
Hit count: 177
In other words, is the following "cursoring" approach guaranteed to work:
- retrieve rows from DB
- save the largest ID from the returned records for later, e.g. in
LastMax
- later,
"SELECT * FROM MyTable WHERE Id > {0}", LastMax
In order for that to work, I have to be sure that every row I didn't get in step 1 has an Id greater than LastMax
. Is this guaranteed, or can I run into weird race conditions?
© Stack Overflow or respective owner