Custom Snippets

TeamSQL has supported snippets for some time, but we’re introducing custom snippets to help you work more effectively.


What are the snippets?

From our snippets post:

Snippets are templates that can help you to build longer queries. Because TeamSQL knows which database you’re working in, you’ll get the right snippet at the right time (if you work in multiple types of databases, you’ll know how easy it is to get similar-but-different syntaxes mixed up). Now, you’re less likely to run a query that works for MySQL against SQL Server (or vice versa).

If you can’t remember the specific syntax, Intellisense can help you out. You can “scroll” through the list of snippets using your arrow keys, and when you’ve found the one you’re interested in, press tab to populate your query window with the snippet. Additionally, if you don’t recall what a specific snippet should do, the drop-down list of snippets includes a brief definition.


What are custom snippets?

Rather than limiting you to snippets, we think you’ll find useful; we’re allowing you to create your snippets. For example, do you see yourself running a specific query early and often? Turn it into a snippet instead of copying and pasting from an external file.


How to Create Custom Snippets

There are currently two ways for you to create custom snippets:

  1. Using the Create Snippets option available in the main toolbar
  2. Creating snippets on the fly by using the options menu

We’ll cover how to use both options.


Use the Create Snippets Option in the Toolbar

In the main toolbar, go to Snippets > Create Snippets.



This opens up the window you can use to create your snippet. You’ll be prompted for a namedescription, and which database environment you want associating with your snippet (you can indeed create one that TeamSQL lets you use in any environment). Finally, you’ll provide your Snippet Text.

When you finish making changes, click Save.



Your snippet is now ready to use.




Creating Snippets on the Fly Using the Options Menu

If you’re working in the TeamSQL editor and realize that you’re typing the same thing over and over again, you can create a snippet right then and there.

Highlight the text you’re working with, and right-click anywhere in the editor window. When the options menu appears, select Create Custom Snippet.



This launches the snippet creation wizard, but notice that your Snippet Textarea has been populated with your highlighted selection. This means that you only have to provide a namedescription, and which database environment you want to be associated with your snippet (you can indeed create one that TeamSQL lets you use in any environment).

When you’re done making changes, click Save.




Viewing Your Snippets

You can display the snippets that you’ve created at any time using the Manage Snippets area.



In addition to seeing a full list of your snippets, you can manage them. You can:

  • Edit your snippets
  • Clone your snippets
  • Delete your snippets

There’s also an option for you to create a new snippet from scratch at the top right.





TeamSQL now supports the creation and use of custom snippets, which is helpful when you find yourself writing the same query multiple times.