Skip to main content

Parallax effect

Sharing Template Explorer in SSMS

I love SSMS Templates, and before Snippets, I used for both reasons.  To access SMSS Templates, go here: View>Template Explorer or Ctrl+Alt+T.  I use them as a place to store those infrequently used SQL Queries.  Those queries that a DBA doesn't want rewrite and reinvent or spending a lot of time remembering where they were last saved.


Several of our team members bought into the idea of using Templates.  What ended up happening is that each team member ended up with a distinct set of Templates or various versions of the same Template.  We desired a solution to keep all templates common among team members and make sure that the team members get all of the updates and additions.  The first step was to agree that we'll keep our Templates in SVN - a move in the right direction.  Storing them in SVN is still awkward as we had to remember to check to see if there was a Template for whatever it was we were doing and update from SVN to be sure - #firstworldproblems

We are attempting to get around this by:
  • We created network share: \\ourserver\path\Templates\SQL
  • We moved all of the templates from the local path to the share
  • We used MLINK to create a symbolic link from the network share to our local computer
I made a batch file to make everyone's life easier, the contents are:

cd %APPDATA%\Microsoft\SQL Server Management Studio\13.0\Templates
ren Sql Sql_Old
mklink /D Sql "\\ourserver\path\Templates\SQL"
This solved most of the problems, everyone has the same set of Templates and anyone can check them in.  The biggest concern is that if you're remote and not using VPN, the path won't resolve and bad things happen.  If anyone has a better solution or ideas, let me know in the comments below.