SELECT
pri_obj_name_full=SCHEMA_NAME(FKU.schema_id)+N'.'+FKU.name,
pri_obj_column=PCOL.name,
ref_obj_name_full=SCHEMA_NAME(PAU.schema_id)+N'.'+PAU.name,
ref_obj_column=RCOL.name
FROM sys.foreign_keys FK WITH (NOLOCK)
INNER JOIN sys.foreign_key_columns FKC WITH (NOLOCK)
ON FK.object_id=FKC.constraint_object_id
AND FK.referenced_object_id=FKC.referenced_object_id
AND FK.parent_object_id=FKC.parent_object_id
INNER JOIN sys.columns PCOL WITH (NOLOCK)
ON PCOL.object_id=FKC.parent_object_id
AND PCOL.column_id=FKC.parent_column_id
INNER JOIN sys.columns RCOL WITH (NOLOCK)
ON RCOL.object_id=FKC.referenced_object_id
AND RCOL.column_id=FKC.referenced_column_id
INNER JOIN sys.tables FKU WITH (NOLOCK)
ON FK.parent_object_id=FKU.object_id
INNER JOIN sys.tables PAU WITH (NOLOCK)
ON FK.referenced_object_id=PAU.object_id
WHERE FKU.is_ms_shipped=0
AND PAU.is_ms_shipped=0
--fk.parent_object_id=object_id('Production.BillOfMaterials')