Skip to content

Instantly share code, notes, and snippets.

@Dillie-O
Created October 17, 2017 23:53
Show Gist options
  • Save Dillie-O/d707ab9aab1730cbfa241fae1deb9347 to your computer and use it in GitHub Desktop.
Save Dillie-O/d707ab9aab1730cbfa241fae1deb9347 to your computer and use it in GitHub Desktop.
[Find Tables with Column] Finds all tables with column names matching input #sql
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 '%MyCol%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment