1, 查找表或SP相互引用的对象
SELECT DISTINCT OBJECT_NAME(referencing_id) AS sp_name
FROM sys.sql_expression_dependencies (NOLOCK)
WHERE referenced_entity_name = '查找表或SP'
ORDER BY sp_name
2, 在Sp中模糊查找字符
SELECT DISTINCT b.name
FROM dbo.syscomments a, dbo.sysobjects b
WHERE a.id=b.id and a.text like '%%'
3,查看表字段被哪些SP更新
SELECT o.name SpName, c.name ColumnName, d.is_updated, d.is_selected, d.is_select_all
FROM sys.objects o
JOIN sys.sql_dependencies d ON o.object_id = d.object_id
JOIN sys.objects o2 ON o2.object_id = d.referenced_major_id
JOIN sys.columns c ON c.object_id = d.referenced_major_id
AND c.column_id = d.referenced_minor_id
WHERE o2.name = 'Sales_Tax_Sku_Mapping'
4, 在所有sp查找存在_某段文字
SELECT DISTINCT OBJECT_NAME(id)
FROM sys.syscomments
WHERE CHARINDEX('ShippingMethodCode VARCHAR(20)',text) > 0
ORDER BY OBJECT_NAME(id)
博客转载链接地址:http://blog.csdn.net/prince_lintb/article/details/28417371