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 (this blog)
- Three examples of the use of snippets
- Creating custom snippets using Snippets Generator
- Importing SQL Snippets into Management Studio
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.
Creating your own snippets of SQL
I've blogged before about creating code snippets in SQL, but I never realised how easy - or how useful - it was to create your own snippets. Before I go any further, credit where it's due:
What | Notes |
---|---|
Original idea | Thanks to Sam for doing the research for this, and for sending me an email detailing how to create your own snippets. All I've done is to turn this into a blog! |
Snippet generator | I've used the excellent snippet generator from SQLArtBits, who are a community of SQL developers. |
Any mistakes which follow are all mine! I've divided this blog up into the following parts:
- Three examples of how you can use snippets that you've generated;
- Creating a snippet using the Snippet Generator tool;
- Importing your custom snippet into SQL Server Management Studio.
So let's get started!
One word of warning: snippets were introduced in SQL Server 2012. So if you're using SQL Server 2008 R2 or earlier, it's time, alas, to find some different lunchtime reading matter.
- Creating your own snippets of SQL (this blog)
- Three examples of the use of snippets
- Creating custom snippets using Snippets Generator
- Importing SQL Snippets into Management Studio