[Pugged] MySql Primary Keys

Dave J. Hala Jr. ciapug@ciapug.org
13 Jan 2003 13:40:54 -0600


I'm using  the following statement to move some records from one table
to another:

INSERT INTO target_table SELECT * FROM source_table where LHP = "A";

Works great.  One problem.  Both tables have a primary key that is an
auto_increment field.    If the source_table has key that is numbered
1000, and there is a record with that key value in the target, then
record doesn't get moved.

I can resequence the keys doing the following,
"ALTER TABLE CHECKS DROP id, ADD id int NOT NULL PRIMARY KEY
AUTO_INCREMENT ", but is there a simple way to renumber the index's in
the target table starting at a certain value?  

:) Dave

-- 

"...Unix, MS-DOS and Windows NT (also known as the Good, the Bad, and
the Ugly)"

OSIS
Dave J. Hala Jr.
641.485.1606