Bryan Love wrote: > Different DB's provide different ways of doing this, but the only universal > way I know of is this: > > Assuming the key is numeric and increments ascending: > <cftransaction> > <cfquery...> > do the insert > </cfquery> > <cfquery...> > SELECT MAX(whateverID) as maxID > FROM tablename > </cfquery> > </cftransaction>
And that does *NOT* work. Let me repeat that, because I know it is a very common mistake. That does *NOT* work. The only thing that will protect you from a phantom read is a transaction with the isolation level "serializable". According to the relevant standards, transactions should default to the isolation level "serializable" and you should be right. However, most databases default to "read committed", and therefore will not protect you from phantom reads. Explicitly adding isolation="serializable" is required. Jochem ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists