Thanks for that, I wasn't aware that @@identity wasn't the best thing to use. Now it's time to change some code :)
On 1/5/06, Robertson-Ravo, Neil (RX) <[EMAIL PROTECTED]> wrote: > You should always use SCOPE_IDENTITY over @@identity if you wish to get the > Id for the newly inserted row in your current session. > > > > > > -----Original Message----- > From: Claude Schneegans [mailto:[EMAIL PROTECTED] > Sent: 04 January 2006 18:52 > To: CF-Talk > Subject: Re: CF and the Stored Procedure Newbie - First in an irregular > series of Eureka! moments. > > >>- CFQUERY to see if the record existed in the database > - CFIF the record exists > - CFQUERY, doing an UPDATE > - CFELSE > - CFQUERY, doing an insert > > Personnaly I use another approach: > Every record is edited by calling anythingEdit.cfm?id=recordId > If the user is creating a new record, he will use the same template with > id=0. > The edit template always starts with a query to get the record to edit > in order to fill the form. > In case of a new record, the query WHERE id=0 returns an empty record, > and all fields in the form > are empty. > Now, in the anythingUpdate.cfm, the logic is simply: > - CFIF id EQ 0 > - CFQUERY, doing an INSERT > - CFELSE > - CFQUERY, doing an UPDATE > > Now, concerning stored procedures, I would say that one of the big > advantage is when you need to do things > that would be difficult, or impossible to do in SQL. > Otherwise, the gain is not really very much more than having the query > precompiled in the database. > For large queries at least, the impact is marginal. > > -- > > _______________________________________ > REUSE CODE! Use custom tags; > See http://www.contentbox.com/claude/customtags/tagstore.cfm > (Please send any spam to this address: [EMAIL PROTECTED]) > Thanks. > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228446 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=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

