MySQL 5.0 - setting foreign key for a column
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   liliyaw_woland
Posted On:   Thursday, March 30, 2006 03:09 PM

Hello everyone,
I'd like to be able to mark one of the columns in table "table1" to be a foreign key from table "table2". Both tables are already populated with data. I use MySQL 5.0. So I'd like to do something like this:
ALTER TABLE table1 ADD FOREIGN KEY (column_to_modify) REFERENCES table2 (id_column_from_table2) ON DELETE CASCADE ON UPDATE NO ACTION;

I get an error when I do this. Any ideas? I will appreciate any input, thank in advance.

Re: MySQL 5.0 - setting foreign key for a column

Posted By:   WarnerJan_Veldhuis  
Posted On:   Thursday, March 30, 2006 05:03 PM

What's the error? (http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html)
About | Sitemap | Contact