SQL Server and Find all Columns in a Database


Find all occurrences of the column in any object.

- April 20, 2015

Rest of the Story:

Where the column name matches exactly…

SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns
WHERE name = '{text}' )
Where the column name is likeSELECT name FROM sysobjects WHERE id IN 
    ( SELECT id FROM syscolumns WHERE name like '%{text}%' )  

The following will show all occurrences of the column in any object
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE '%doctorid%'