Find all tables containing column with specified name

In order to find a column name anywhere it is used in a table or view I was able to use the following SQL…

SELECT      COLUMN_NAME AS 'ColumnName'
            ,TABLE_NAME AS  'TableName'
FROM        INFORMATION_SCHEMA.COLUMNS
WHERE       COLUMN_NAME LIKE '%columnnameyouarelookingfor%'
ORDER BY    TableName
            ,ColumnName;

sql

Author

david

comments powered by Disqus