In SQL Server, write a stored proc and get @@identity.  Works everytime.

Jeff Garza
Lead Developer/Webmaster
Spectrum Astro, Inc.
480.892.8200
[EMAIL PROTECTED]
http://www.spectrumastro.com



-----Original Message-----
From: Voris, Jim [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 29, 2002 1:12 PM
To: CF-Talk
Subject: Getting the id of the row you just inserted...


It seems to me that there are three basic ways to get the id of the row you
just inserted.
1)  @@identity
and
2)  cflocking the insert statement and the select max(id) statement.
and
3)  qualifying the select max(id) statement to avoid problems caused by
multiple threads.

I'm curious which method people use and which they find to be the best.


______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to