Solved! Optimized way to do it:
Use 1 query to add, then a second query to retrieve LAST_INSERT_ID(). LAST_INSERT_ID() will return the last ID stored within the same session so it's not prone to the mix-ups that can happen with MAX(). Thanks all! Jonothon Ortiz Vice President Xnext, Inc. Macromedia Alliance Partners http://www.Xnext.com mailto:[EMAIL PROTECTED] -----Original Message----- From: jt [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 11:34 AM To: CF-Linux Subject: RE: snagging the recently created PK of a record in MySQL - Help? Hello, I am moving a DB from MS SQL Server 2000 to PostgreSQL (hooray!!!). Any tips or tricks to share? I am especially interested in how to auto-increment ids in Postgresql, if there are any caveats, and how to transfer the data over after the tables and such are built. Thanks, Josh ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm ------------------------------------------------------------------------------ Archives: http://www.mail-archive.com/cf-linux%40houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_linux or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
