Microsoft SQL Server 2005 Database Design Best Practices

How to find all tables where a column occurs?

 

Execute the following script in Query Editor to find all occurances of the "addressid" column:

use AdventureWorks;

select
[Schema]=s.name,
[Table]=o.name,
[Column]=c.name
from sys.columns c
join sys.objects o
on c.object_id=o.object_id
join sys.schemas s
on s.schema_id=o.schema_id
where c.name='addressid'
order by [Table]


 

The Best SQL Server 2005 Training in the World
 
 
SQLUSA.com Home Page