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

Categories

Recent Tweets

@ACLU n to pay for a long time. I yu the
#Xamarin Certified Trophy arrived today! @XamarinU thanks! https://t.co/TpYsSkBW6Y
Retweeted by @dyardy #PowerShell and Kerberos double hop. Slides, module, and demos. aka.ms/pskdh #PshSummit
@danrigby @Raspberry_Pi Very cool, let us know how it goes, thx