SQLServerCentral Article

SQL Prompt Tips #3 - Snippet Placeholder $Paste$

,

SQL Prompt is an amazing productivity enhancement tool for SQL developers. However there are a number of features that many people are not aware of. These tips will help you learn more about ways in which SQL Prompt can speed your development. We urge you to try each of these tips out for a week or two and see if you find them helpful.

There's a link to a video demonstration of this tip as well.

Snippet Placeholders

One of the neat things that SQL Prompt allows you to do is store code in snippets. Snippets are like templates in SSMS, but they can be inserted into your queries with a few keystrokes, saving you lots of time. For example, one of the most common snippets is "ssf", which is included with SQL Prompt. If I type ssf, I'll see this in SQL Prompt.

The tip that pops up below, shows me this is a script, and there description is "SELECT * FROM fragment". If I wait a second, I'll actually get a pop up with the code in the snippet (as shown here).

If I hit tab, or enter, then I'll get that code inserted.

However I can change this snippet slightly. I can find it in the Snippet Manager and hit Edit.

From there, I can add the $PASTE$ placeholder into my code. 

This will place the contents of my clipboard in the script when it's inserted. I click OK and save this.

Now I return to my query window and copy the name of a table.

I then erase everything in my window. When I type "ssf" and hit tab, I get this:

There are a variety of placeholders, and we'll discuss others in another tip, but they are very handy for customizing your snippets, and speeding up your development.

Video

You can see a video demonstration of this tip below from Tom Crossman, one of Red Gate's talented employees working on SQL Prompt.

Rate

5 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

5 (1)

You rated this post out of 5. Change rating