Separate methods might make sense if you need to do this from more than one method. If it is specific to that method it might not be worth breaking it up.
Be aware though that inserting a record and then selecting the MAX id can result in an incorrect ID if more than one thread runs this code at the same time. You'd probably be better off getting the last inserted ID from the cfquery itself if you are on CF8, or looking at using a native database function like scope_identity() (the actual function varies across platforms). A bit more can be found here: http://www.forta.com/blog/index.cfm/2007/7/6/ColdFusion-8-Can-Return-Identity-Values On Tue, Aug 19, 2008 at 10:22 AM, Scott Stewart <[EMAIL PROTECTED]>wrote: > This is more of a "how would you do it" question. > > I have a simple set of queries that are currently inside an cfif > statement, the "if "block inserts a record, grabs the id of the just > inserted record, and there's an optional update that runs if some one > else is entering there record. > I know I can just dump the queries into a function and it'll work... > > But would I be better served by creating separate functions and call the > last two from inside the insert function? > > -- > Scott Stewart > ColdFusion Developer > > Office of Research Information Systems > Research & Economic Development > University of North Carolina at Chapel Hill > > Phone:(919)843-2408 > Fax: (919)962-3600 > Email: [EMAIL PROTECTED] > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311259 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4