Hi @M Jugnu ,
Please refer below query and check whether it is helpful to you.
USE DATEBASENAME --YOUR DATABASENAME
GO
SELECT t.name AS FKTableName
, fk.name AS NameOfForeignKey
, pc.name AS FKColumn
, rt.name AS ReferencedTable
, c.name AS ReferencedColumn
FROM sys.foreign_key_columns AS fkc
INNER JOIN sys.foreign_keys AS fk ON fkc.constraint_object_id = fk.object_id
INNER JOIN sys.tables AS t ON fkc.parent_object_id = t.object_id
INNER JOIN sys.tables AS rt ON fkc.referenced_object_id = rt.object_id
INNER JOIN sys.columns AS pc ON fkc.parent_object_id = pc.object_id
AND fkc.parent_column_id = pc.column_id
INNER JOIN sys.columns AS c ON fkc.referenced_object_id = c.object_id
AND fkc.referenced_column_id = c.column_id
where t.name in ('Sales','Marketing''Product','Finance','Profit','Design')
Best regards
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.