> SHOW TABLE STATUS FROM yourdatabasename LIKE 'departments'
> which will show us the constraints for table departments..-Martin-----

Apologies constraint was missing, this works

ALTER TABLE assets
ADD CONSTRAINT FOREIGN KEY (end_dateID) REFERENCES end_dates(end_dateID)
ON DELETE CASCADE


+-----------+--------+------------+------+----------------+-------------+---
--------------+--------------+-----------+----------------+-------------+---
----------+------------+------------------+-----------------------+
| Name      | Type   | Row_format | Rows | Avg_row_length | Data_length |
Max_data_length | Index_length | Data_free | Auto_increment | Create_time |
Update_time | Check_time | Create_options   | Comment               |
+-----------+--------+------------+------+----------------+-------------+---
--------------+--------------+-----------+----------------+-------------+---
----------+------------+------------------+-----------------------+
| end_dates | InnoDB | Fixed      |   17 |            963 |       16384
|            NULL |            0 |         0 |             18 | NULL
| NULL        | NULL       | row_format=FIXED | InnoDB free: 11264 kB |
+-----------+--------+------------+------+----------------+-------------+---
--------------+--------------+-----------+----------------+-------------+---
----------+------------+------------------+-----------------------+


Where this wont

ALTER TABLE assets
ADD CONSTRAINT FOREIGN KEY (manufacturerID) REFERENCES manufacturers
(manufacturerID)
ON DELETE RESTRICT

+---------------+--------+------------+------+----------------+-------------
+-----------------+--------------+-----------+----------------+-------------
+-------------+------------+--------------------+-----------------------+
| Name          | Type   | Row_format | Rows | Avg_row_length | Data_length
| Max_data_length | Index_length | Data_free | Auto_increment | Create_time
| Update_time | Check_time | Create_options     | Comment               |
+---------------+--------+------------+------+----------------+-------------
+-----------------+--------------+-----------+----------------+-------------
+-------------+------------+--------------------+-----------------------+
| manufacturers | InnoDB | Dynamic    |   19 |            862 |       16384
|            NULL |            0 |         0 |             21 | NULL
| NULL        | NULL       | row_format=DYNAMIC | InnoDB free: 10240 kB |
+---------------+--------+------------+------+----------------+-------------
+-----------------+--------------+-----------+----------------+-------------
+-------------+------------+--------------------+-----------------------+





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

Reply via email to