Ever need to find what Tables have reference to a certain Column? This SQL Script will query the System Tables to find all references to a given Column Name. A GUI like SSMS would be helpful but it is nice to have an easy script to produce such a report.
Source: http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tables-of-database/ Author: Pinal Dave
USE [DatabaseName]
GO
-- Searcj all Tables for a given Column Name
-- Refine WHERE Clause to suit your needs
SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c
ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%ColumnName%'
ORDER BY schema_name,
table_name;