Last active
October 23, 2018 13:37
-
-
Save nikolasd/26a5181dd4887d9b8e96671f0f3c78d0 to your computer and use it in GitHub Desktop.
Εύρεση ενός FK σε όλα τα Tables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
OBJECT_NAME(f.parent_object_id) TableName, | |
COL_NAME(fc.parent_object_id, fc.parent_column_id) ColName | |
FROM sys.foreign_keys AS f | |
INNER JOIN sys.foreign_key_columns AS fc | |
ON f.OBJECT_ID = fc.constraint_object_id | |
INNER JOIN sys.tables t | |
ON t.OBJECT_ID = fc.referenced_object_id | |
WHERE COL_NAME(fc.parent_object_id, fc.parent_column_id) = 'HEPRLSID' | |
ORDER BY OBJECT_NAME(f.parent_object_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment