如何在 Sql Server 2008 R2 存储过程中搜索字符串?
我正在将旧版 SQLS2k 迁移到 2008R2,似乎所有数据访问都是通过存储过程完成的,并且任何自定义查询都使用旧版 *=
=*
外连接语法。有超过一百个过程,所以我不想单独打开每个过程来查看它是否使用该语法(大多数不会),有没有一种方法可以查询元数据以获取过程/函数/视图列表/triggers,然后循环搜索 *=
或 =*
字符串,打印出有问题的对象的名称?
我的背景是oracle,我知道如何在那里找到元数据视图,但我对Sql Server有点陌生。降级兼容性版本不是一个选项。
谢谢!
I'm migrating a legacy SQLS2k to 2008R2, and it seems all data access was done through stored procs, and any custom queries use the legacy *=
=*
outer join syntax. There are upwards of a hundred procs so I don't want to open each one individually to see if it uses that syntax (most wouldn't), is there a way I can query the metadata for a list of procs/functions/views/triggers, then loop through searching for the *=
or =*
strings, printing out the name of the offending object?
My background is oracle, I know how to find the metadata views there, but I'm a bit new to Sql Server. Downgrading the compatibility version is not an option.
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
免费 Red Gate SQL 搜索?
或查询sys.sql_modules
注意:INFORMATION_SCHEMA 视图和系统注释截断了定义,因此不可靠。
Free Red Gate SQL Search?
Or query sys.sql_modules
Note: INFORMATION_SCHEMA views and syscomments truncate the definition so are unreliable.
使用查询的问题是,如果存储过程已加密,则这些查询将不起作用,除非您正在运行 DAC 连接类型。
这就是第三方工具派上用场的地方,因为它们可以帮助您轻松完成此操作。我正在使用免费的 ApexSQL Search,但我想您使用 Red Gate 或任何其他工具。
Problem with using queries is that these don’t work if stored procedure is encrypted unless you’re running DAC connection type.
This is where third party tool come in handy because they help you do this without too much hassle. I’m using ApexSQL Search that’s free but I guess you can’t go wrong with Red Gate or any other tool out there.