Drop the keys and references, change it, and then re-create the keys
and references.

http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html

(a SHOW CREATE TABLE will show you the constraints including foreign
keys -- copy those, so you can create them later.  Then you can use
ALTER TABLE to drop the keys, change your columns, and then you can
use ALTER TABLE to add the keys back in, although it sounds like you
won't have a primary key in the new table).

-Sheeri

On 2/17/06, Tomáš Vichta <[EMAIL PROTECTED]> wrote:
> Hello,
> I need to turn off all constraints in a table (especially primary and
> foreign keys) - because for example I need to exchange primary key
> values of two rows in a table. And because of primary key constraints I
> can do it directly. I would to turn off the constraint, rename value of
> PK1 to PK2 - now I have the same 2 values PK2 and it's the problem, if
> the primary key constraint is enabled.
>
> Thanx very much for answer, TV.
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>

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

Reply via email to