Almost all the answers are MS SQL-centric. Not sure what type of development house you work in, but MS-SQL centric answers are not a valid solution for some of us. Both Oracle and MS SQL have several methods to retrieve the last primary key in a particular table. I won't bore you with my opinion which I think is a better and more elegant solution as both are effective.
If you want to be able to 100% retrieve the last record you inserted into any DB system simply use a dateTime Stamp. Do a select against the inserted fields and the datetimestamp. If you need sample code, email me off the list and I will cut and paste something for you. Won Lee ______________________________________________________________________ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists