本文介绍了存储过程版本控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何管理存储过程的修订?

How do you manage revisions of stored procedures?

我们在 SQL Server 2005 上有一个包含数百个存储过程的 BI 解决方案.将这些放入 Subversion 的好方法是什么?您推荐的将存储过程脚本化到文件的工具有哪些?

We have a BI solution on SQL Server 2005 with hundreds of stored procedures.What would be a good way to get these into Subversion? What are your recommended tools to script stored procedures to files?

推荐答案

毫无疑问,您可以购买大量现成的产品(我认为一些 RedGate 工具在这里可能会派上用场),以及 VisualStudio Team Suite - 数据库版.

There are doubtless a bunch of off-the-shelf products you could buy (I think a few RedGate tools might come in handy here), as well as Visual Studio Team Suite - Database Edition.

鉴于购买东西,为什么不考虑使用 SQL 管理对象 (SMO))?

In light of purchasing something, why not consider using SQL Management Objects (SMO)?

我编写了几个生成 T-SQL 脚本的实用程序(使用 Scripter 类),它们生成的脚本与您通过 SQL Server Management Studio 生成脚本所获得的脚本相同(它使用相同的功能).

I've written a couple of utilities which generate T-SQL scripts (using the Scripter class) which produces the same scripts you get from generating scripts through the SQL Server Management Studio (it uses the same functionality).

您可以将这样的实用程序集成到构建脚本/构建过程中,这将允许您生成脚本,然后进行版本更新.将它们检入源存储库.此外,您可以将脚本批处理到单个文件中(如果需要),这胜过维护数百个单独的文件.

You could integrate such a utility into a build script/build process which would allow you to generate scripts and then version & check them into a source repository. Plus, you can batch the scripts into a single file (if desired) which beats maintaining hundreds of individual files.

我不久前写了一篇关于这种方法的博客文章.

I wrote a blog entry about this approach a while back.

查看关于 SMO 类的更多信息编剧

这里还有一些可能有用的条目:

Here's a few more entries which might be useful:

http://www.sqlteam.com/article/scripting-database-objects-using-smo-updated

http://sqlblog.com/blogs/ben_miller/archive/2007/10/03/table-scripting-with-smo-part-1.aspx

这篇关于存储过程版本控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 20:09