A couple of things before we get started:
- SQL Server Management Studio, version 2012 or later
- A SQL Server database, version 2005 or later
- Even LocalDB will do. No judgment here.
Head over to versionsql.com and sign up for a trial. You’ll receive links to two files:
- The VersionSQL installer
- Your trial key file
Download both of those files to a safe location, then run the VersionSQL installer. After installation has completed, open SQL Server Management Studio and connect to your database. Verify that a "VersionSQL" now appears in the top menu bar.
If you’re connecting to anything more powerful than SQL Server Express, VersionSQL will ask you for the key file at some point. Have your ticket ready, please.
Choosing a Version Control System
If you already have a version control system in place, just skip right on to the next section.
If you’re new to the world of version control, welcome! Like any new field, at first there seems to be an overwhelming number of options. The simplest way to move forward is opening a GitHub account and creating a private repository there. Done that? The URL in your browser address bar is your "repository path". Copy that to your clipboard; you’ll need it in a minute.
In the Object Explorer pane, right-click on your database and select "Connect to Version Control" from the context menu. Paste in your repository path and click OK. VersionSQL will prompt you for your version control login credentials, either directly or through your web browser. Follow directions and in no time you’ll see a message confirming that VersionSQL is connected.
Now we get to the fun part. The first time you commit, VersionSQL will ask if you want to send everything the version control. Click
Yes and you’ll be off to the races. Sit back and watch those stored procedures scroll by! Once it’s all processed, another window will pop up asking for your thoughts on the operation. Give it a piece of your mind and press
OK to push all that out to the version control system. Done!
Integrating into your Workflow
Ah yes, this was for work.
Version control is like insurance: When you need it, the history is there — if you kept up with the premiums. The premium here is remembering to commit your code. Just ALTERed an SP? Give it a quick commit. The week flown by and you’re not sure what you changed? Run a full-DB commit for good measure. Then when disaster strikes and you need to know when that submit stored proc stopped writing to the finance tables, you’ll have all the data you need.
But what does it look like?
Grab your popcorn, it’s movie night!
Short and action-packed.