[Pugged] MySql Primary Keys
Dave J. Hala Jr.
ciapug@ciapug.org
13 Jan 2003 18:52:59 -0600
I think I'm just going to add a 100,000 to each field in the source
table, then add 200,000 to the target table.... that should take care of
it...
On Mon, 2003-01-13 at 18:39, dave@visionary.com wrote:
> "Dave J. Hala Jr." <dave@58ghz.net> said:
>
> >
> > 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?
> >
>
> Not sure about that. One thing that I have noticed is that mysql will
> let you import from a text file into a table with a PK set without any
> special commands - like in MS-SQL, you have to do something like "set
> identity-insert off" (don't recall the exact syntax).
>
> I don't know if this would be considered a good thing or a bad thing...
>
> -dc
>
> _______________________________________________
> Ciapug mailing list
> Ciapug@ciapug.org
> http://cialug.org/mailman/listinfo/ciapug
--
"...Unix, MS-DOS and Windows NT (also known as the Good, the Bad, and
the Ugly)"
OSIS
Dave J. Hala Jr.
641.485.1606