Quick way to find usages of DB Objects in SQL Server 2008?

泄露秘密 提交于 2019-12-13 17:33:18

问题


Just like Alt F1 gives you information about any DB object., Is there any quick way to find out at what all places is a particular db object refered to. For instance:

-A table used in other stored procs. 
-A stored proc used in other stored procs. 
-A user defined type used as table value parameter in stored procs.

and so on...

In the past i have used Red Gate SQL Search but i will have to take permission here at my company to install it.

Queries will do too.


回答1:


The dependencies information is a lot more robust in 2008 than previous versions as you no longer get permanently missing dependency info when creating objects in the "wrong" order.

Stealing the example from Books Online

SELECT referencing_schema_name, 
       referencing_entity_name, 
       referencing_id, 
       referencing_class_desc, 
       is_caller_dependent
FROM sys.dm_sql_referencing_entities ('Production.Product', 'OBJECT');



回答2:


It's free, use Red-Gate SQL Search http://www.red-gate.com/products/sql-development/sql-search/




回答3:


If you right click on an object in SQL Server Management Studio, there's a 'View Dependencies' feature.

What's the difficulty in getting SQL Search installed on your company machines?



来源:https://stackoverflow.com/questions/7341127/quick-way-to-find-usages-of-db-objects-in-sql-server-2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!