M
Mark Burns
General Question: How do Transactions affect the use of AutoNumbers?
Specifically, in the Scenario:
Begin transation
<Insert Query here into a table with an AutoNumber column (ID)>
Rollback
If, the last ID in the above table is, say 10 before the transaction begins,
(and no other users are hitting the table to mess things up here), after the
rollback, is the next ID that would be generated still 11, or is it now 12?
(11 having been "burned" during the abortive transaction...?)
I'm actually interested in possibly using this as a means of grabbing a
unique-but-not-necessarily-sequential ID number (one that's a throw-away for
all other purposes, but useful in generating a unique ID string for a
calculated key string value), say by grabbing the max(ID) value in a select
query before rolling back the transaction...
Anybody have any thoughts on this? (other than having to do it quickly to
minimize the risks of concurrency problems.)
Specifically, in the Scenario:
Begin transation
<Insert Query here into a table with an AutoNumber column (ID)>
Rollback
If, the last ID in the above table is, say 10 before the transaction begins,
(and no other users are hitting the table to mess things up here), after the
rollback, is the next ID that would be generated still 11, or is it now 12?
(11 having been "burned" during the abortive transaction...?)
I'm actually interested in possibly using this as a means of grabbing a
unique-but-not-necessarily-sequential ID number (one that's a throw-away for
all other purposes, but useful in generating a unique ID string for a
calculated key string value), say by grabbing the max(ID) value in a select
query before rolling back the transaction...
Anybody have any thoughts on this? (other than having to do it quickly to
minimize the risks of concurrency problems.)