Stored Procedure Versioning

断了今生、忘了曾经 提交于 2019-12-18 16:38:16

问题


How do you manage revisions of stored procedures?

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?


回答1:


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.

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

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.

Check out more on the SMO class Scripter

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




回答2:


See here and here for a start.




回答3:


Please check out here What is the best way to version control my SQL server stored procedures?. Might help you identify couple of solutions to this issue.




回答4:


I have previously used a Visual Studio Database Project to manage create table scripts, stored procedure scripts etc. I'm fairly sure you could then use subversion to manage these files in the same way as any Visual Studio project.

I used the built in functionality for scripting the procs, but i'm sure Redgate would have some tasty tools for that.



来源:https://stackoverflow.com/questions/183148/stored-procedure-versioning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!