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

1/1/2016·1 min read
Responsive image
Photo by AltumCode on Unsplash

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