Jay, As long as the DBMS enforces the transaction suggested by ColdFusion your approach should be fine and as others have suggested, auto-incrementing the particular field might be better left to other mechanisms at the DBMS level.
However, providing you are happy to handle it in ColdFusion, your example code is unnecessarily complicated. Doing the following will achieve precisely the same effect: <cftransaction> <cfquery name="Q_nextId" ...> SELECT MAX(MY_TABLE.my_column) + 1 'nextId' FROM MY_TABLE </cfquery> <cfquery name="Q_theInsert" ...> INSERT INTO MY_TABLE ( my_column ) VALUES ( #Q_nextId.nextId# ) </cfquery> </cftransaction> 1) If there is an error with either of the two queries the transaction will be rolled back without you having to do so explicitly. 2) An exception will be thrown without you having to explicitly catch and rethrow it. 3) If there are no exceptions, the transaction will be committed without you having to do so explicitly with a <cftransaction action="commit"> tag. 4) The isolation level defaults to "Serializable" and the opening <cftransaction> tag always has an implicit action of "begin" so it is not necessary to explicitly state these - though no damage is done by doing so. Regards, Andr� ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
