4/22/2011

how to find column dependencies in SQL server ? SQL server 2005 / 2008

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 :)...

select name
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.


http://msdn.microsoft.com/en-us/library/ms177862.aspx


Love SQL server tips ? For more Subscribe here or click here to get updates via email

8 comments:

Excellent. Thanks for the article. Came in handy.

This is is very perfect for me because I couldn't get enough information related to this and finally I got it, that's why I feel so interested in continue reading more and more to make wide my knowledge.

Great post! I can't believe I found this article, seriously that was just what I was looking for! Thank you very much for you blog, that is so informative and handy!

The Beats Tour has the accustomed http://www.monstersbeatbydres.us/pro.html 20hz to 20,000 khz aggregate response. 20hz appears a little bit ample for an earbud that states for accepting a “good reproduction of hip hop”. On the accustomed agenda the Monster Dre Beats Sale abate account the abundant bigger the bass. From advice 14hz could possibly be the optimal value. However, the Beats Tour earbuds accept an amazing disciplinarian design. As quoted abroad from your Tour’s aspect list: “Large, high-efficiency motorists acquiesce you crank it up and acknowledge loud authority out after any sound- accident distortion. “Driver allocation is amidst http://www.monstersbeatbydres.us/studio.html apparently the a lot of acute apparatus to appearance up for if affairs earbuds (especially if you in fact acquaintance for just about any superb bass response). because of the tiny size, earbuds on the accustomed agenda accept characterless drivers. The Tour earbuds accompaniment ample drivers, and centered abreast to the favorable chump response, it appears the ample motorists allocation produces up to the characterless aggregate response.

This is really helpful. It's just great that you i can find this kind of information online.

Very useful thanks...

Trên thế giới có nhiều loại đông trùng hạ thảo, có loại đông trùng hạ thảo rất quý như đông trùng hạ thảo tây tạng của Việt Nam ở nước chúng ta. Đông trùng hạ thảo là loại có dưỡng chất tốt nhất.
cửa hàng đông trùng hạ thảo hàn quốc quận 1
cửa hàng đông trùng hạ thảo hàn quốc quận 2
cửa hàng đông trùng hạ thảo hàn quốc quận 3

Post a Comment