> Tony wrote: >> does that retrieve the newest UUID Primary Key generated? >> right now, i have a dateAdded field that i sort by, to >> get the newest one.
> That's not real reliable. What happens if two records are > added in the > same second? :) > Yes, it returns the last identity inserted, and inside a > transaction, I > think it's reliable. Minor clarification: when using scope_identity() with a single cfquery tag, the cftransaction tags aren't necessary to make this reliable. Scope_identity() returns specifically the identity last inserted in the current batch statement. Which means that it can't be used (or at least not reliably) if you use two separate cfquery tag pairs, however, if there's only one cfquery tag pair with both the insert and select statements in it, then that obviates the need for the cftransaction (and I believe it will also improve performance in comparison to using the cftransaction around either one or two queries). I don't think I've actually tried using scope_identity() with two cfqueries, so I don't know if it would produce an error or just produce bad or unreliable data. I suspect it would produce an error. s. isaac dealey 434.293.6201 new epoch : isn't it time for a change? add features without fixtures with the onTap open source framework http://www.fusiontap.com http://coldfusion.sys-con.com/author/4806Dealey.htm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236879 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