Search for Column Name in All Tables
In MS SQL Server 2000 and above there is an undocumented stored procedure that enables you to search through all tables for a particular column name. Example usage:
SQL:
-
sp_MSforeachdb
-
'print ''?'';
-
use [?];
-
select table_name
-
from information_schema.columns
-
where column_name like ''TheColumnNameToFind'''
Note: select the "Results in Text" or "Results to Text" option before executing the above.
Thanks to my friend Ras for this tip.
Comments: