Find all occurrences of the column in any object.
- April 20, 2015
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 like…
SELECT 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%'