Skip to content

Instantly share code, notes, and snippets.

@mwinckler
Created October 25, 2012 22:58
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 mwinckler/3956001 to your computer and use it in GitHub Desktop.
Save mwinckler/3956001 to your computer and use it in GitHub Desktop.
Find all tables in SQL server having column name
-- From http://stackoverflow.com/a/4849704/81554
SELECT c.name AS ColName, t.name AS TableName
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%MyName%'
SELECT COLUMN_NAME, TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%MyName%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment