On 11 Jul 2003 at 15:41, Ray wrote:

> and after a while someone wanted something that would always be first
> in the table when ordered, so i added the entry to it and edited the
> id to be -1.  now whenever anything is added to the table it gets an
> id of 2147483647
> 
> how do i fix it so that it start the auto_increment at the correct
> spot again?

Don't try to put nonpositive values into an AUTO_INCREMENT column:

|   MySQL Version 3.23 will also only work properly if the
|   AUTO_INCREMENT column only has positive values. Inserting a
|   negative number is regarded as inserting a very large positive
|   number.
http://www.mysql.com/doc/en/CREATE_TABLE.html

Now that you have one, delete it (or change it to a positive number), 
then find the maximum ID:

    SELECT MAX(ID) FROM pics2003;

and reset the AUTO_INCREMENT counter to one more than that value:

    ALTER TABLE pics2003 AUTO_INCREMENT = [one more than the MAX];

If you need to sort by something other than the ID, you should 
introduce a new column to sort by rather than changing the ID values.

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Tobacco Documents Online
http://tobaccodocuments.org


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to