SQL Server 2005 - 查找运行到特定表的存储过程 [英] SQL Server 2005 - Find Which Stored Procs Run To A Particular Table
本文介绍了SQL Server 2005 - 查找运行到特定表的存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
- 有什么快速的方法可以找到哪些存储过程运行到我的数据库中的特定表?
- 数据库非常大,有很多表和 SPROCS....
推荐答案
如果你想限制搜索到存储过程,那么你可以这样做:
If you want to restrict the search to stored procedures then you can do this:
SELECT name
FROM sys.objects
WHERE type = 'P'
AND OBJECT_DEFINITION(object_id) LIKE '%name_of_your_table%'
ORDER BY name
如果您想包含其他 SQL 模块——例如,函数、触发器、视图等——那么您可以更改查询以执行 WHERE type IN ('P', 'FN', 'IF', 'TF', 'V')
等,或使用 马丁的回答.
If you wanted to include other SQL modules -- for examples, functions, triggers, views etc -- then you could alter the query to do WHERE type IN ('P', 'FN', 'IF', 'TF', 'V')
etc, or use the alternative given in Martin's answer.
这篇关于SQL Server 2005 - 查找运行到特定表的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文