In this post I thought I would talk about using version control for SQL Server Management Studio templates. In addition, I will mention other applications you can do the same with towards the end.
I wanted to write this post because in a previous post I discussed how SQL Server Professionals can benefit from using version control. Which you can read in detail here.
Now I want to take this one step further. By giving examples of how Data Platform professionals can benefit from using version control outside of building deployment pipelines.
With this in mind, using version control for SQL Server Management Studio templates is a good example.
Of course, if you are already using version control as part of building deployment pipelines that’s good. However, if all of this is still fairly new to you, these examples will help you spark your imagination.
With this in mind, I thought I would use SQL Server Management Studio as an example. Within this post I will also refer to SQL Server Management Studio as SSMS.
SQL Server Management Studio templates
I thought I would start with the most powerful way you can benefit from using version control with SSMS here.
Within SSMS you can take advantage of template explorer to quickly open up templates for common SQL scripts. Which you can see if you click on ‘View’ menu item and then select ‘Template Explorer’.
When you first open it you will see templates already created for you. In addition, you can create your own templates for use. You can read more about what you can do with templates here.
One thing you can do is use your folder which has your templates stored in as a local Git repository. Afterwards you can start sharing template changes you make locally with others.
You can do this by synchronising it to a more central Git repository for others to access.
For example, synchronising your repository with a Git repository in Azure Repos or in GitHub. Afterwards, others can then synchronise with your templates by converting their template folders to local repositories and synchronising with this one.
Which makes it a lot easier to share templates that have been created specifically for your organisation for use.
Taking working with templates further
Now let’s take it one step further. Say a group of people want to customise their own set of templates based on the one that you have created.
What you can do is make a copy of these templates from the repository. When using Git, one of the most efficient ways that you can do this is to make a fork of this repository on the main server.
You can read how to fork a Git repository within Azure Repos in detail here.
In reality, there are other ways that you can achieve this as well.
For example, you can create a new branch of the repository if you thought everybody was going to end up using it. However, if you kept this branch for a while you could run into some issues. Especially if updates are done to the master branch a lot.
Registered Servers in SQL Server Management Studio
Another thing a lot of SQL Server Professionals do in SSMS when they work with multiple instances is register them all within the application. So that they can navigate to all of them easier.
However, if you move to a new server you have to register those servers again. In addition, whenever a new colleagues starts it is always good practice to provide them with these registered servers in advance.
Luckily, you can export your list of registered servers out of SSMS into a single file to import elsewhere. Which you can also add into version control as well.
In fact, you could combine the location of the templates and the registry file into one single location. Which means you could create a git repository which is easy to synchronize for new starters.
In reality, the above example could be used with various other desktop applications that use some form of templates or configuration files.
For example, the ones that are listed below.
- Microsoft Office applications
- Windows PowerShell
- Azure Data Studio
- Docker Desktop
I hope that you enjoyed my post about using version control for SQL Server Management Studio templates.
I wanted to help you see the possibilities of using version control with applications.
If you have done a similar thing in the past, or even something a bit more “out there” with version control then feel free to leave a comment.