Find a column in a SQL Server database
19 May 2005
in mid-afternoon
Matt Winckler
(via Planet Source Code) On SQL Server 2000 or 7.0, to search a database and find all tables (or views) containing a given column (for example, “SoughtColumn“), run the following query:
SELECT SO.Name FROM SysColumns SC
INNER JOIN SysObjects SO on SO.ID = SC.ID
WHERE SC.name = 'SoughtColumn';
