SQL Server List All Foreign Keys with Referenced Tables
Every database with foreign keys eventually needs a single inventory: each constraint, the table and column that hold it, and the table and column it points at. This T-SQL script joins sys.foreign_keys to sys.foreign_key_columns, sys.tables, and sys.columns to produce that map for the current database, with one row per …
Read More