Why We Built Snippets Generator
Code snippets is a handy way of reusing pieces of code you frequently need. As in many development environments, SQL Server 2012 or later supports code snippets. With Snippets Generator you can create or modify existing snippet files easily, using an intelligent GUI. You do not need to know XML, etc. in order to do this. You just use Snippets Generator, enter the T-SQL script, generate the snippet file and that's it! Right after that you can just import the snippet into SQL Server's Management Studio.
Download Snippets Generator
- - You can now save your snippets as templates
- - Check for updates
- - Reset formatting
- - GUI enhancements
You can download Snippets Generator from the below download links:
* Supported SQL Server versions: 2012 or later.
Total Downloads: 1182
Snippets Generator allows the user to easily create/modify T-SQL snippets for SQL Server! You can create a snippet from scratch or by using snippet templates.
Figure 1: Main Screen of Snippets Generator.
Creating a Snippet
You can generate T-SQL snippets in five ways:
- - By writing the T-SQL script from scratch.
- - By pasting the script from the clipboard.
- - By dragging and dropping a text or sql file onto the T-SQL text box.
- - By using an existing T-SQL snippet template from Snippet Templates Library and complete the script based on the template.
- - By modifying an existing script.
Importing a Snippet in SQL Server Management Studio (SSMS)
After you generate the snippet, you can import it in SQL Server Management Studio 2012 or later using the following procedure:
- Create a new folder and save the generated snippet file(s) there.
- In SSMS, click on "Tools" and then select "Code Snippet Manager".
- Click on the "Add" button and select to add the folder you earlier created and which contains the generated snippet file(s).
- Click on the "OK" button.
- That's it! You can now start using your own T-SQL code snippets!
Modifying an Existing Snippet
You can modify snippets by navigating to File --> Open Snippet. When you open a snippet, its data is automatically retrieved and imported into the relevant fields. Then you can modify the snippet and re-generate it.
Setting a Default Author Name
You can set a default author name by by navigating to Configure --> Set Default Author or by pressing the keys Ctr + D.
Formatting the Snippet Text and Basic Syntax Highlighting
You can format the snippet text and apply basic syntax highlighting by using the shortcuts just right below the snippet code's box. Available actions:
- Word Wrap
- Basic Syntax Highlighting
- Increase/Decrease Font Size
Explanation of Fields
- - Title: The title of your snippet as it will appear in SSMS snippet manager.
- - Description: A short description of what your snippet does.
- - Author: Name of the person who authored the snippet.
- - Snippet Type: The type of the snippet.
- -- Expansion: A new block of T-SQL statements.
- -- SurroundsWith: A T-SQL statement which surrounds other statements i.e. Begin..End.
- - T-SQL Script: The snippet code.