Re: How to turn off all constraints in a table?

2006-02-21 Thread SGreen
Once CHECK CONSTRAINTS are enabled, I am sure there will be a way to turn them off temporarily. Right now, you can create tables that have them but they are not enforced. To quote http://dev.mysql.com/doc/refman/5.0/en/create-table.html InnoDB tables support checking of foreign key cons

Re: How to turn off all constraints in a table?

2006-02-21 Thread SGreen
Easier than that (though Sheeri's way would work): ALTER TABLE yourtablename DISABLE KEYS; SET FOREIGN_KEY_CHECKS=0; ... do your processing ... SET FOREIGN_KEY_CHECKS=1; ALTER TABLE yourtablename ENABLE KEYS; http://dev.mysql.com/doc/refman/5.0/en/alter-table.html http://dev.mysql.com/doc/refman/

Re: How to turn off all constraints in a table?

2006-02-20 Thread sheeri kritzer
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

How to turn off all constraints in a table?

2006-02-17 Thread Tomáš Vichta
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