4,707 questions
Try the following code:
select t.name as TableWithForeignKey, fk.constraint_column_id as FK_PartNo, c.name as ForeignKeyColumn
from sys.foreign_key_columns as fk
inner join sys.tables as t on fk.parent_object_id = t.object_id
inner join sys.columns as c on fk.parent_object_id = c.object_id
and fk.parent_column_id = c.column_id
where fk.referenced_object_id = (select object_id
from sys.tables
where name = ' Product')----add your tablename
order by TableWithForeignKey, FK_PartNo
IF you want to get useful information by simple code,you could try it:
EXEC sp_fkeys ' Product'
Best regards,
Bert Zhou