declare @max_id int begin select @max_id = max(id) from table if @max_id = NULL select @max_id = 1 else select @max_id = @max_id + 1 end
Douglas Brown Email: [EMAIL PROTECTED] ----- Original Message ----- From: "chris.alvarado" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Tuesday, July 23, 2002 9:05 AM Subject: Retrieving last inserted Primary Key > I know this topic has been flogged to death, but here it goes again. > > What is the preferred Method of retrieving the last inserted Primary > key? > > NOT using a stored proc and the @@Identity method, so what about using > CF in line queries. > > Any suggestions? > > -chris.alvarado > [ application developer ] > 4 Guys Interactive, Inc. > http://www.4guys.com > > -- I can picture in my mind a world without war, a world without hate. > And I can picture us attacking that world, because they'd never expect > it. -- Jack Handy > > > ______________________________________________________________________ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm 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

