通过所有存储过程使用搜索/替换的最快/最简单的方法 [英] Quickest/Easiest way to use Search/Replace through all stored procedures
问题描述
实际上,这是一个由两部分组成的问题.
Actually, this is a 2 part question.
是否可以使用某种功能来搜索字符串的每个存储过程并可能替换它,就像标准的查找/替换函数一样?
Is it possible to use some sort of functionality to search through every stored procedure for a string and possibly replace it, like a standard Find/Replace function?
如果您的所有存储过程代码都包含像这样的完整数据库路径 [db1].[dbo].[table1]
并且您将数据库名称更改为 [db2]
有没有办法让 SQL Server 自动将 [db1]
表中的所有代码更新为 [db2]
?还是必须手动完成?
If you have all your stored procedure code include the full database path like this [db1].[dbo].[table1]
and you change the database name to [db2]
is there a way for SQL Server to automatically update all the code from [db1]
tables to [db2]
? Or does it have to be done manually?
推荐答案
要搜索:如果您需要按名称查找数据库对象(例如表、列、触发器) - 请查看免费 名为 SQL Search 的 Red-Gate 工具可以执行此操作 -它会在整个数据库中搜索任何类型的字符串.
To search: if you need to find database objects (e.g. tables, columns, triggers) by name - have a look at the FREE Red-Gate tool called SQL Search which does this - it searches your entire database for any kind of string(s).
对于任何 DBA 或数据库开发人员来说,它都是一个很棒的必备工具 - 我是否已经提到它绝对免费可用于任何用途?
It's a great must-have tool for any DBA or database developer - did I already mention it's absolutely FREE to use for any kind of use?
然而,这个工具不支持替换文本——但即使只是能够找到所有相关的存储过程(或其他数据库对象)确实非常有帮助!
This tool doesn't support replacing text, however - but even just being able to find all the relevant stored procedures (or other DB objects) is very helpful indeed!
这篇关于通过所有存储过程使用搜索/替换的最快/最简单的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!