What’s the little popup window in #SQLPrompt?

Awhile back I was working in SSMS and saw this window.

2016-11-21 16_25_51-SQLQuery1.sql - localhost_SQL2016.sandbox (PLATO_Steve (66)) - Microsoft SQL Ser

It threw me off since I was trying to write some code and hadn’t expected it. I clicked Escape, Enter, a few things and was getting frustrated when it disappeared.

I ignored it until I saw the window again and then investigated. I’m glad I did because I was able to answer a question from someone else recently that didn’t know how to get rid of it.

Tl;Dr CTRL will make it appear or disappear.

When I am working with SQL Prompt, it’s in the background. I usually just depend on it to pop up some code or give me information. This means when I have a cursor, there’s no sign of SQL Prompt. Notice this below.

2016-11-21 16_27_38-SQLQuery1.sql - localhost_SQL2016.sandbox (PLATO_Steve (66))_ - Microsoft SQL Se

As soon as I select an area, as little as one space, I get a small SQL Prompt window in the left sidebar. As you can see in the image below, this has a down arrow on it.

2016-11-21 16_27_44-SQLQuery1.sql - localhost_SQL2016.sandbox (PLATO_Steve (66))_ - Microsoft SQL Se

I can click on this, but being a keyboard person whenever possible, I accidently discovered that CTRL will expand this, as shown below.

2016-11-21 16_29_34-SQLQuery1.sql - localhost_SQL2016.sandbox (PLATO_Steve (66))_ - Microsoft SQL Se

What threw me initially is that not all my snippets are in this list. Only those that have the $SELECTEDTEXT$ token inside them. These are handy snippets that I want to use to encapsulate text.

For example, let me surround a simple query.

2016-11-21 16_32_00-SQLQuery1.sql - localhost_SQL2016.sandbox (PLATO_Steve (66))_ - Microsoft SQL Se

I see the SQL Prompt icon and can click CTRL to open the list. If I type “cv”, I get the Create View snippet.

2016-11-21 16_32_11-SQLQuery1.sql - localhost_SQL2016.sandbox (PLATO_Steve (66))_ - Microsoft SQL Se

Once I then hit tab, I get the snippet with my query inside.

2016-11-21 16_32_22-SQLQuery1.sql - localhost_SQL2016.sandbox (PLATO_Steve (66))_ - Microsoft SQL Se

This is especially handy with things like TRY..CATCH, where I can write the TRY part and then quickly surround it with the structure.

Once you get used to this, and learn not to habitually tap the CTRL key (as I do), you’ll find this list of snippets handy. And if you don’t like them, just tap CTRL and get rid of the list.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.

4 Responses to What’s the little popup window in #SQLPrompt?

  1. Leon Carpay says:

    this way of using the little popup window, with the $SELECTEDTEXT$ token, opened my eyes yet a little further concerning sql prompt; what a great flexible tool. It make me develop nearly as fast as I can think!


  2. way0utwest says:

    It’s pretty amazing. I have found it makes my coding faster, especially for certain tasks that I repeat often.


  3. Thomas Franz says:

    I’m using the popup not for inserting snippets, but for options like
    – Format SQL
    – Unformat (removes all line breaks e.g. in a IN condition)
    – add commas / quotes
    – comment / uncomment


  4. way0utwest says:

    I just saw those items from another Redgate person last week. They are cool I tend to use the shortcuts for these, but it’s nice to know they’re in the little window.


Comments are closed.