Code Snippet - Use T-SQL to Search Table Name by Column Name

2015/12/311 min read
bookmark this
Responsive image

SQL example to search table name in case if you only know the column name

SELECT AS 'TableName',  AS 'ColumnName'
FROM        sys.columns c
JOIN        sys.tables  t   ON c.object_id = t.object_id
WHERE LIKE '%MyColumn_DontKnowWhichTableIs%'
ORDER BY    TableName