Monday, 18 August 2025

Below query will get the table FK reference table list.

 Below query  will get the table FK reference table list. 

DECLARE @InputTableName NVARCHAR(128) = 'company_master';

 SELECT DISTINCT 

    OBJECT_NAME(fk.referenced_object_id) AS referenced_table
FROM sys.foreign_keys fk
WHERE OBJECT_NAME(fk.parent_object_id) = @InputTableName
  AND OBJECT_NAME(fk.referenced_object_id) IS NOT NULL
ORDER BY referenced_table;

 

 

No comments:

Post a Comment

SQLDBA : export or download SSIS packages

As part of the SSIS package upgrade planning, we need to ensure that the latest source code for all deployed packages is available in our so...