Skip to main content

Posts

Showing posts from December, 2017

SQL Server | Find all references of a Column

I came across this simple query which can list out all the references columns of a particular column 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; It will give all the reference tablename and schema name along with column name as well