Transactions and AutoNumbers Question

G

Guest

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.)
 
G

Guest

(BTW - the answer to the above is "yes", it's now 12, 11 having been
"burned" in the abortive transaction)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top