Is there a way to identify fields in a view that are referenced by other objects in the database (e.g. procs, UDFs, other views)?
I have about 50 views that reference as its underlying data an external DB. The local views basically ‘SELECT *’ from the external DB tables.
We’re changing the external DB and we need to figure out what fields are actually being used by the application that uses the views so we can setup the new external DB to contain only those fields we need.
Thanks!
Use:
This will allow you to search for view references, including specific column references.
Background:
SYSCOMMENTS, INFORMATION_SCHEMA.VIEWS and INFORMATION_SCHEMA.routines have NVARCHAR(4000) columns, while SYS.SQL_MODULES definition column is NVARCHAR(MAX). So if “myViewName” is used at position 3998, it won’t be found.SYSCOMMENTSdoes have multiple lines, butROUTINEStruncates.