Skip to content

Instantly share code, notes, and snippets.

@oskarnrk
Last active October 11, 2018 09:38
Show Gist options
  • Save oskarnrk/62c8edaaffc50fcd6766ff5435539e3f to your computer and use it in GitHub Desktop.
Save oskarnrk/62c8edaaffc50fcd6766ff5435539e3f to your computer and use it in GitHub Desktop.
Search which tables have a column by 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 '%MyName%'
ORDER BY TableName
,ColumnName;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment