If your DB is Oracle, you can easily use "MERGE" SQL command for this purpose.
HTH Qasim On 8/30/07, Nick de Voil <[EMAIL PROTECTED]> wrote: > > Jay > > > Which of these two methods would be faster? > > > > --------- Method 1 --------- > > > > <cfquery> > > SELECT * FROM table WHERE someID = #someVar# > > </cfquery> > > > > <cfif query.recordCount IS 1> > > <cfquery>UPDATE table...</cfquery> > > <cfelse> > > <cfquery>INSERT INTO table...</cfquery> > > </cfif> > > > > --------- Method 2 --------- > > > > <cfquery> > > DELETE FROM table WHERE someID = #someVar# > > </cfquery> > > <cfquery>INSERT INTO table...</cfquery> > > You can achieve an improvement by either: > > - changing your logic so that you "know" whether to do an update or > insert without needing to check the record ID against the database; or > > - whichever of the 2 methods you use, combining the 2 SQL statements > into one stored procedure or at least one CFQUERY. > > Nick > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ColdFusion is delivering applications solutions at at top companies around the world in government. Find out how and where now http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287545 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

