Ronan Lucio wrote:MySQL will let you specify a value for an auto_increment column, or update the value later.Hi, Can I insert specifying the data into a auto-incremental column?Explain better: We have a database (MySQL-4.0.17) that I need to syncronize with a off-line software. If a client was inserted in the off-line software, I´ll need to import the client datas to the central database. The client ID is an auto-incremental column, but if I leave MySQL set the client ID, it´s supposed to be different from the off-line software. I'm not sure if I agree with this feature or not. It is handy in some cases, but those cases are where you are doing something that you shouldn't be doing. You will NOT be able to update the values if it conflicts with an existing auto_increment value. For this reason, you are better off letting MySQL choose the best value, and then using last_insert_id() ( see the docs ) to retreive the value you've been given. Then use this value to update all related tables ( including the offline database ). As a design rule, you shouldn't be letting the offline database dictate the auto_increment values in the main server - it should be the other way other. Either way, it's a little dodgy, but the above way is better. Dan --
IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au |
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]