jkmills78
8/25/2016 - 1:16 PM

List all foreign keys in database

List all foreign keys in database

use myDatabase

SELECT
    fk.NAME,
    OBJECT_NAME(parent_object_id) 'Child table',
    OBJECT_NAME(referenced_object_id) 'Parent table',
    fk.*
FROM sys.foreign_keys fk