7

I am working with a team of 5 persons. We are using SQL Server as our database. Since long time I want to store the Stored Procedures in SVN so that the versions can be maintained. Is there any tool which can be used as a plugin with SQL Server Management Studio and allows checkin from there.

6

Sounds like Red Gate's SQL Source Control might be what you're looking for.

It says it connects to "TFS, SVN, SourceGear Vault, Vault Pro, Mercurial, Perforce, Git, and any source control system with a capable command line," and that it "links your databases to your existing source control system straight from SSMS".

I haven't used it personally, but I have used other Red Gate SQL tools, and they have been excellent.

  • I am looking for some open source tool. Redgate tools are right now not fitting our budget. – Kuntal Shah Sep 3 '11 at 10:44
4

SSDT projects are great for this these days.

You keep all your db & proc & function definitions in script files (which define your model) and within Visual Studio sync the model with your database / publish to a database to update it. As all your object definitions are in script files you can have them under source control using SVN/Hg/whatever.

3

If I remember correctly (it's been years since I've used SQL Server), you can execute external scripts using osql.

For each stored procedure, I'd write a sql script that removes the current one (if it exists) and creates the new version. Saving these in external .sql files will allow you to easily commit them to any versioning system. Then, you could write a script using your language of choice to update the database whenever you want.

Obviously you'd want to create a backup of your current database prior to running your script in case all goes to hell.

  • I am looking for some more automated way that may be more error free. – Kuntal Shah Sep 3 '11 at 10:53
  • It works pretty well (we do that here) but the key is that nothing is ever put on QA or prod unless it comes form the source control system. Since devlopers do not have the rights to deploy to other servers, their code doesn't get deployed unless they check it in. – HLGEM Feb 6 '13 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.