I have come across this article detailing how dependencies work and I was wondering if it would be possible to use these to see which views (if any) a field is contained within.
I've come across topics such as this one which show how to find which entities are used within views, but I was hoping to be able to drill down a bit further and instead find out if a field is linked to any views? (Using Sql server 2005)
Thanks!
Have a look at this (free) tool: http://www.atlantis-interactive.co.uk/products/schemasurf/default.aspx
which (quote):
Awesome tool.
For your question
one could use the system view VIEW_COLUMN_USAGE in your database. I created this view
Using the query below:
I recieved this result which includes the column and table name
Add a WHERE clause to the query and you should get your answer.
If you wish to look at constraints use the view "[INFORMATION_SCHEMA].[CONSTRAINT_COLUMN_USAGE]"
My system is MSSS 2K8 your 2K5 system should have the same system views
Red Gate Software's SQL Prompt 5 has a Column Dependencies feature that might be useful in this situation. You hover over a column name in a script, and up pops a window containing a list of objects that use that column, including views.
You can download a 14-day trial for free, to see if this feature works for you.
Paul Stephenson
SQL Prompt Project Manager
Red Gate Software