En la dirección recomendada por
quimfv, puedes leer esto en los comentarios de Usuarios (pon los datos de tu base, tablas y columna o campo donde corresponde. No lo he probado:
Cita: User Comments
Posted by James Goatcher on May 27 2008 6:36pm [Delete] [Edit]
A quick way to list your FKs (Foreign Key references) using the KEY_COLUMN_USAGE view:
Código sql:
Ver originalSELECT CONCAT( TABLE_NAME, '.',
column_name, ' -> ',
referenced_table_name, '.',
referenced_column_name ) AS list_of_fks
FROM information_schema.KEY_COLUMN_USAGE
WHERE REFERENCED_TABLE_SCHEMA = (your schema name here)
AND REFERENCED_TABLE_NAME IS NOT NULL AND REFERENCED_COLUMN_NAME = nombrecampo
ORDER BY TABLE_NAME, COLUMN_NAME;
Cita: This query does assume that the constraints and all referenced and referencing tables are in the same schema.
Le he añadido
AND REFERENCED_COLUMN_NAME = nombrecampo
Haz algunas pruebas