如何查找sql server数据库中常量的使用情况
有没有办法在一组(存储过程、函数、视图)中搜索常量的用法?
我有一个 sql server 数据库的问题。它声明了相当多的存储过程和函数。我正在寻找“115”的用法,它恰好是一个支付代码。我最初并没有编写所有代码,因此我正在寻找声明常量或按字面意思使用字符串“115”的任何位置。
Is there a way to search through the set of (Stored Procedures, Functions, Views) for the usage of a constant?
I have a problem where I've got a sql server database. It has quite a few stored procedures and functions declared. I'm looking for the usage of "115", which happens to be a pay code. I didn't write all of the code originally, so I'm looking for anywhere that a constant is declared, or the string "115" is used literally.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这也包括 sys.sql_modules 和 sys.procedures 中省略的约束等
This includes constraints etc too that are omitted in sys.sql_modules and sys.procedures
您可以在 sys.sql_modules 中搜索
定义 LIKE N' %115%'
:您可能会得到一堆误报,但至少您有一个起点。
You can search sys.sql_modules for
definition LIKE N'%115%'
:You may get a bunch of false positives, but at least you have a starting point.
SQL Server 2000:
SQL Server 2005:
两个示例均取自:
http://blog.sqlauthority.com/2007/11/10/sql-server-2005-2000-search-string-in-stored-procedure/
类似:
http://www.knowdotnet.com/articles/storedprocfinds.html
在此示例中:
SQL Server 2000:
SQL Server 2005:
Both examples taken from:
http://blog.sqlauthority.com/2007/11/10/sql-server-2005-2000-search-string-in-stored-procedure/
Similarly:
http://www.knowdotnet.com/articles/storedprocfinds.html
with this example: