How often do you forget the syntax for simple things like creating roles, logins or triggers. You might not have to create them very often, so simple tasks like these might occasionally get truncated from your brain memory. Well, SQL 2012 has made life much easier for us by adding what they call Code Snippets. These snippets will allow us to simple create a script shell for all sorts of objects and they are super simple to use. Here is how you use them.
When you are in SSMS (SQL Server management Studio) and open a New Query window, you can simply right-click in that window and click on Insert Snippet… (You can also type Crtl+K, Ctrl+X)
This will display server different object in which you can create a generic code snippet for. In this case, we will look at creating a basic Stored Procedure shell. Once you choose the Create a single stored procedure option, generic code is created for you to use.
All you have to do is fill in the highlighted sections.
The same is true for all of the other objects listed in the snippets. You might already know the syntax to all of this, most of us DBA’s do, but this is also a no brainer and time saver in the sense that it is very easy to click n’ create. This can help new developers and old developers alike.
Take a minute and check it out.