Hi Stephen,

The short answer is no, it's not possible for another insert to sneak in because you do this within a transaction.

Your way has to be done using a transaction too or you'll run the risk of failed updates if a second query to get the next value sneaks in between your getting the value and doing your insert.

The whole point of transactions is that all the queries that make up the transaction happen atomically, in other words, they happen as if it's one big long query and other queries cannot sneak in between statements.

To me it makes more sense to let the auto increment happen rather than to force in the ID yourself. That's why I prefer to do it the way described above.

Regards,

Bart.