存储过程 SQL Server 中的文本搜索 [英] Text search in stored proc SQL Server

查看:29
本文介绍了存储过程 SQL Server 中的文本搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道在 SQL Server 中用于文本搜索的脚本吗?我想从 SQL Server 内的所有存储过程中搜索文本,有人知道我应该使用什么脚本吗?

Does any one know the script to use for text search in SQL Server? I would like to search a text from all the stored proc inside the SQL Server, does anyone know what is the script I should use?

推荐答案

INFORMATION_SCHEMA.ROUTINES 或 syscomments 可靠.

INFORMATION_SCHEMA.ROUTINES or syscomments are not reliable.

两者的文本字段都是 nvarchar(4000)(仅限多行 syscomments).因此,您的搜索文本可能会在 syscomments 的边界上丢失,或者在 INFORMATION_SCHEMA.ROUTINES 中找不到

The text field is nvarchar(4000) for both (over multiple rows syscomments only). So your search text can be lost on the boundary for a syscomments or never found for INFORMATION_SCHEMA.ROUTINES

sys.sql_modules.定义是nvarchar(max)

sys.sql_modules.definition is nvarchar(max)

SELECT
    OBJECT_NAME(object_id)
FROM
    sys.sql_modules
WHERE
    definition LIKE '%mytext%'

编辑,2011 年 10 月

Edit, Oct 2011

更新这个答案.

Red Gate SQL 搜索是一个免费 SSMS 插件,非常有用.

Red Gate SQL Search is a free SSMS plug in that is quite useful.

这篇关于存储过程 SQL Server 中的文本搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆