Find Tables with a Column Name In a DataBase

Posted by kgovindarao523-21772 under Sql Server category on | Points: 40 | Views : 862

I came up with scenario which is to find out all tables names that contains a specific column.

Here is the code.
SELECT DISTINCT SCHEMA_NAME(schema_id) + '.' + AS 'Table Name'
FROM sys.tables t
     INNER JOIN sys.columns c
        ON c.object_id = t.object_id
WHERE like '%YOURColumn%'
ORDER BY 'Table Name'

Comments or Responses

Login to post response