As other people have said, start with each saved proc in a separate text file under source control. Write a script that will delete all stored procedures and then re-create them from text files (when registering / reporting any errors) - this script should be easy to run. Then every time you update the source code, restart the script. All changes to stored procedures should be performed in a text file, and not in a "live" copy in the local database, otherwise you will lose the changes when updating.
You will soon want to audit your database schema and create upgrade scripts, etc.
If you are using a SQL server only, consider SQL Compare from Reg-Gate . I think that it will compare the stored procs (and other sql) in the text file with what is in your database and synchronize them. Thus, you can use the editing tools in SqlServer to edit live stored procedures.
(As of the end of 2009, Red-Gate is about to send Sql Compare to Oracle )
I was told that ApexSQL Diff is another option instead of Sql Compare, ApexSQL Edit claims to provide version control integration.
In the high-end, consider the Visual Studio Team System Database Database Edition, however it is very expensive, then you may have to pay even more for third-party support for Oracle. But if you are a Microsoft partner (or you can become one of them), you can get some help very cheaply.
See also You control the source data of your databases in StackOverflow to get a good answer to a big problem.
Ian Ringrose Jan 22 '09 at 11:53 2009-01-22 11:53
source share