I have to add a few columns to a table and I also need to add these columns to all the views that use this table.
Is it possible to get a list of all the views in a database that use a certain table?
I have to add a few columns to a table and I also need to add these columns to all the views that use this table.
Is it possible to get a list of all the views in a database that use a certain table?
7条答案
按热度按时间tktrz96b1#
This should do it:
efzxgjgh2#
To find table dependencies you can use the sys.sql_expression_dependencies catalog view:
You can also try out ApexSQL Search a free SSMS and VS add-in that also has the View Dependencies feature. The View Dependencies feature has the ability to visualize all SQL database objects’ relationships, including those between encrypted and system objects, SQL server 2012 specific objects, and objects stored in databases encrypted with Transparent Data Encryption (TDE)
Disclaimer: I work for ApexSQL as a Support Engineer
wh6knrhe3#
I find this works better:
Filtering
VIEW_DEFINTION
insideINFORMATION_SCHEMA.VIEWS
is giving me quite a few false positives.lsmepo6l4#
If you need to find database objects (e.g. tables, columns, triggers) by name - have a look at the FREE Red-Gate tool called SQL Search which does this - it searches your entire database for any kind of string(s).
It's a great must-have tool for any DBA or database developer - did I already mention it's absolutely FREE to use for any kind of use??
p1iqtdky5#
xkrw2x1b6#
select your table -> view dependencies -> Objects that depend on
c9x0cxw07#
Simplest way to find used view or stored procedure for the tableName using below query -