Some RDBMS allow you set a 'seed' value for auto-incrementing columns. I
haven't looked at this in awhile, but I know of a couple of work-arounds:

- Set the first record in your INSERT to an explicit value (4711, etc.),
then put NULLs in subsequent rows.

- Insert a bogus record with a number one digit lower than your desired
beginning number. The next record will start where you want it.

- I think you can also use the INSERT_ID = # command in later versions of
MySQL. The next record should auto_increment from the number you specify.

A note of caution ... if you are inserting explicit values into an
AUTO_INCREMENT column, make sure the number you are inserting hasn't already
been used or you won't like the results.

Gerald Jensen

----- Original Message -----
From: "Alexander Skwar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 2:58 PM
Subject: mysqldump loses auto_increment


Hello.

I've just created a table with a auto_increment column.  I then did

ALTER TABLE tbl AUTO_INCREMENT=4711;

Now, when I insert one row into this table, it get's 4711 as the
auto_increment column's value.  However, dumping this table with

 mysqldump --opt DB tbl

loses the auto_increment value i set.  So, if I'd replay the dump, the
first time I insert a row it would get 1 for the auto_increment, and not
4711.

How to circumvent this?

Alexander Skwar
--
How to quote: http://learn.to/quote (german) http://quote.6x.to (english)
Homepage: http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 13 hours 25 minutes

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to