BLOGS BY TOPIC▼
BLOGS BY AUTHOR▼
BLOGS BY YEAR▼
With SQL Server 2012 came the power not just to use pre-defined code snippets, but also to create your own - this blog explains how.
- Creating your own snippets of SQL
- Three examples of the use of snippets
- Creating custom snippets using Snippets Generator
- Importing SQL Snippets into Management Studio (this blog)
Posted by Andy Brown on 23 November 2017
You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Importing SQL Snippets into Management Studio
Having created one or more snippets, here's how to use them! First select this menu option in SQL Server Management Studio:

I'm using SSMS for SQL Server 2016, but it should be the same in older and newer versions (provided that you're on at least 2012).
Now choose to add the snippets that you've created:

The choice of language at the top isn't particularly inspiring: SQL or SQL ...
Browse to the folder containing your snippets, and select it:

You can also add individual files, but it seems easier to put all of your snippets into a single folder.
This folder (and any of its subfolders) should immediately appear in the list:

It's a shame Wise Owl comes so late in the alphabet. We did consider calling ourselves Aardvark Training way back in 1992 - perhaps we should have!
You can now add your custom snippets!

The snippet will appear in the appropriate submenu, according to whether it's type is Expansion (as here) or SurroundText.
If only everything in IT was this simple and easy to use!
- Creating your own snippets of SQL
- Three examples of the use of snippets
- Creating custom snippets using Snippets Generator
- Importing SQL Snippets into Management Studio (this blog)