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';

React

This comment form is Markdown-enabled, in addition to allowing the following XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .