Couple of ideas for you: Don't delete records. Create a "deleted" field and mark them deleted.
If you are trying to find out the record number of a newly inserted record, you can wrap your insert in cftransaction, and then run a "select @@identity from table" before /cftransaction (that's SQLServer, might be different syntax for you.) You can also reset the identity field if you really really need to. See the article at http://www.quantumsoftware.com.au/Support/KB/Article.aspx?ID=125 Okay I guess I did not really answer your question, but this is the best answer I have. [email protected] on Wednesday, November 28, 2007 at 5:07 PM -0800 wrote: >I am using ColdFusion MX 7.0 with a MySQL database. > >One of my tables has an autoincrement field called "intKey" (without the >quotes, obviously) as the key. > >Is there a way to programatically determine the number of the next record >that will be added to the database? > >For example, if I have ten records (with keys of 1 through 10) and I >delete records 8, 9, and 10, the next record that will be inserted will >be 11. Therefore it's not a matter of using the Max(intKey) function and >adding 1, because that would say that the next record will be 8 instead >of 11. > >Is there something I am missing here? > >Thanks! > >Chris > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Get involved in the latest ColdFusion discussions, product development sharing, and articles on the Adobe Labs wiki. http://labs/adobe.com/wiki/index.php/ColdFusion_8 Archive: http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3170 Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
