Tuesday, July 18, 2017

Handy Tools

Just found a plethora of free SQL Server tools here: https://www.apexsql.com/Download.aspx

Tables Related by Column

Found a short query that shows how tables in a database are related by column (i.e. they share a column):

SELECT
  A.COLUMN_NAME,
  a.TABLE_NAME,
  b.TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS A
JOIN INFORMATION_SCHEMA.COLUMNS B
  ON A.COLUMN_NAME = B.COLUMN_NAME