搜索存储过程,视图,函数(Table-valued Function, Scalar-valued Function)内容。
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
DECLARE @search_word NVARCHAR(MAX) = 'CAST' SELECT sys.objects.name AS [Object Name] FROM syscomments INNER JOIN sys.objects ON syscomments.id = sys.objects.object_id WHERE type_desc IN ( 'SQL_STORED_PROCEDURE', 'VIEW', 'SQL_TABLE_VALUED_FUNCTION', 'SQL_SCALAR_FUNCTION' ) AND [text] LIKE N'%'+ @search_word +'%'
以上搜索关键词"CAST",结果在列表中对象都曾应用过这个关键词。
再列举一个例子:
打开上面对任意一个对象来看:
再举例说明: