Up:: MS Sql

Get the foreign keys to a table in MS Sql

  • Language:: T-SQL
  • Type:: Persistent Storage
  • Context:: Getting the tables that are linked to the queried table using foreign keys
  • Snippet
EXEC sp_fkeys 'TableName'

You can also specify the schema:

EXEC sp_fkeys @pktable_name = 'TableName', @pktable_owner = 'dbo'

📇Additional Metadata

  • 📁Type:: snippet
  • 🏷️Tags::
  • 📡Status:: #status/🌲