Skip to content

How SQL Server Professionals can benefit from using version control

Reading Time: 5 minutes

In this post I thought I would talk about how SQL Server Professionals can benefit from using version control systems. Mostly because I have been involved in some discussions about it recently.

I say SQL Server Professionals here because I want it to be all inclusive. Due to the fact this applies to database administrators and operations staff who use SQL Server as well.

In fact, a lot of the content in this post also applies for other Data Platforms professionals as well.

Now, it is true that a lot of SQL Server professionals use source control to some degree. For example, some check documents in and out of some applications.

However, quite often it’s just for basic use with certain applications for managing one document at a time.

Of course, I know there are a lot of SQL Server professionals out there who already use a good version control system and know its benefits.

In contrast, there are also others out there who think that using version control systems are only for SQL Server developers or engineers.

Because version control systems are often related to some form of DevOps related practices. Which some administrators and operations staff have limited dealings with.

Current methods

I’m sure some professionals still keep multiple versions of files manually somewhere. Using a form of version control that they have come up with.

For example, how many of you still use any of the below methods to manage your SQL Server scripts?

  • Adding a timestamp to filenames.
  • Stored away in an email, somewhere.
  • Slightly changing the name of the file.
  • Putting a number at the end of each version.
  • Storing files on an external device or in the cloud.
  • Saving another version of the file in another folder.
  • Multiple downloads of your favourite scripts from online.

If you use any of the above methods to manage your files then you can definitely take advantage of using a modern version control system.

Because as efficient as you think these methods are, the main problem is that we are all human and prone to error. In general, if you have not opened up the wrong file or misplaced one already the odds are that one day you will.

For example, say you have a favourite SQL Server script and you have your own system to keep track of the right version. You could end up losing it, regardless of which methods you use to find it.

Version control

Which is why a version control system can be used as an alternative solution instead to make your life as easier. No more relying on your own system you have created to locate the right file.

Of course, if using version control is fairly new to you, you might want to start somewhere you know is secure. For example, online in GitHub or using a Git repository in Azure DevOps.

You might want to go through the ‘Introduction to version control with Git’ module on the Microsoft Learn website first. You can find out more about that in detail here.

My advice is to look around and see which method will work best for you as a starting point.

SQL Server scripts example

For example, say you have a collection of favourite SQL Server scripts you want to share with your colleagues. In addition, your company has purchased a Visual Studio subscription for you so that you can work in Azure.

You could take advantage of the fact that you can create your own Azure DevOps organization. To do this you can access your Visual Studio Subscription benefits here.

If you create an Azure DevOps organization this way it is secure by default. Because by default the only person who can access it when you create it this way is yourself. However, you can add others afterwards.

After you have created a project you can then create a repository to store your files.

It’s a good idea to first put the right versions of your scripts in one place on your local machine. In addition, also make sure Git is installed.

If you are using a Windows based operating system either install Git for Windows or check if it has been installed with Visual Studio.

Afterwards, you can either use Git Command Line or Visual Studio to add your favourite scripts to a repository you have created locally on your machine.

Once that is done you can sync your local repository with the one you have created in Azure DevOps server. Doing this opens up a lot of options for what you can do with those SQL Server scripts.

For example, you could simply keep them the copy in Azure DevOps as the one source of truth. Whenever you wanted to change a script update it locally first, and then if it works sync with the server.

If you decide later you want to revert a change that is also possible.

Sharing

Of course, this also gives you options if you want to share with colleagues as well.

You can give them permission to access your repository inside your Azure DevOps organization. Which means they can all do the same with their local copies of the files and then merge back.

In fact, you can take it one step further and check their updates by putting in branching policies. Allowing you or your colleagues to view what changes they want to make before the files are updated.

In addition, allows you to discuss proposed changes with them before they are approved.

If they wanted to, they could make a copy to work with in another environment. Which some of them could work on independently. Whilst all this is happening the history of the files would be easy to trace in Azure DevOps.

Powerful

Hopefully you can now see how SQL Server Professionals can benefit from using a version control system. It can be very a very powerful tool to use in the workplace.

In addition, it’s a lot easier than having to mentally juggle where versions of various files are. It also means no more digging around in multiple folders or trying to locate files using search in explorer.

Benefits

If this is new to you then there are various benefits to learning how to use version control. Such as enabling you to contribute to open source offerings in the community.

For example, say you had an idea for a PowerShell cmdlet that the dbatools module could use. Which is a very popular module in the SQL Server community, and you can read about in detail here.

If you learn how to use version control at a decent level you will be able to create your module and submit it as a proposed cmdlet.

Future proof

Of course, this can also help you future proof your career as well. Because a lot more companies these days are looking for SQL Server professionals with DevOps related skills.

Which was one of the topics I covered in a three-part post in a story format. Which you can read part one in detail here.

Final word

Anyway, I hope you enjoyed this insight about how SQL Server Professionals can benefit from using version control.

As I hope the above shows, using version control opens up many possibilities for SQL Server professionals. In addition, there are many benefits to doing this.

Of course, this is just the tip of the iceberg. Learning version control and Azure DevOps can also open up many other possibilities for you. Especially since things in the industry are changing at a rapid pace.

Of course, you are more than welcome to comment about any content in this post.

How SQL Server Professionals can benefit from using version control
Published inAzure DevOpsSQL ServerVersion Control

11 Comments

  1. Throwing up a link to this on my blog. Lots of good points for us DB people to consider.

  2. Kendra Little Kendra Little

    YES! I think you are right on with this.

    One additional thing I would add is that for one-off scripts that people may want to share with the public, which don’t need an entire repo, GitHub ‘Gists’ are free and very easy to use: https://gist.github.com/discover

Leave a Reply

Your email address will not be published. Required fields are marked *