Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@DCCoder90
Created August 27, 2018 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DCCoder90/297723fb9452e6b5800c6ca15d324e7d to your computer and use it in GitHub Desktop.
Save DCCoder90/297723fb9452e6b5800c6ca15d324e7d to your computer and use it in GitHub Desktop.
Query that searches system tables to identify a table that has a specified column name
SELECT c.name AS 'ColumnName'
,t.name AS 'TableName'
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%COLUMN NAME%'
ORDER BY TableName
,ColumnName;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment