Not necessarily. One of the SQL Server variables is a global variable, so you can call it anytime for the last ID, with no knowledge of who inserted it or even what table. If that's what you care about, then a transaction is irrelevant. WIth MySQL's LAST_INSERT_ID() it's tracked by connection (not globally), and since CFMX allocates a DB connection per request, you don't really need the transaction there either, though I would recommend it.
Hence the "depending on specifics" hedge. ;) cheers, barneyb On Mon, 31 Jan 2005 14:08:24 -0500, Rick Root <[EMAIL PROTECTED]> wrote: > Barney Boisvert wrote: > > That's a horrible way to do it. Quite inefficient. > > > > A better route is to check your DB's docs and see how they expose the > > last inserted sequence value. In MySQL it's LAST_INSERT_ID(), with MS > > SQL Server its one of three @IDENTITY variables. Run your INSERT, and > > then select the value back out using this mechanism. You may or may > > not need a transaction, depending on the specifics, and you definitely > > won't need CFLOCK. > > That's only reliable inside a transaction. Don't leave that part out. > > - Rick > > -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 6 invites. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192393 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

