Did you ever want to find the dependencies of a column in all the tables and stored procedures in the database ! It helps you sometimes in finding the impact of the changes you want to make very easily. May be if you dont know about the database, it would help you understand the size of the changes you want to make.
Its very simple. All you need to do is just fire this query :)...
from syscomments c
join sysobjects o on c.id = o.id
where TEXT like '%TableName%' and TEXT like '%ColumnName%'
Replace the Table name and the column name with the name of the table where the column is and the column name itself.
What is syscomments ?
As per MSDN, syscomments contains entries for each view, rule, default, trigger, CHECK constraint, DEFAULT constraint, and stored procedure within the database. The text column contains the original SQL definition statements.
What is Sysobjects ?
Sysobjects contains one row for each object that is created within a database, such as a constraint, default, log, rule, and stored procedure.
These are part of system views which you can find in the link below.
Love SQL server tips ? For more Subscribe here or click here to get updates via email