>That would ONLY work if you used SET TRANSACTION ISOLATION LEVEL >SERIALIZABLE or WITH(TABLOCKX HOLDLOCK) > >Even with with rowlock, another spid can insert additional records into >the table and the select max() might return a bogus value.
Aside from being unsafe without the right isolation level, it is not necessary in MSSQL 2005 or CF8+. As use mentioned use SCOPE_IDENTITY() or cfquery's result attribute. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333203 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

