Custom Placeholders in SQL Prompt 7

I love my snippets in SQL Prompt. Adding some snippets can make work go so much quicker.  I add new ones all the time, based on the tasks I’m doing and I find that code can almost write itself.

SQL Prompt 7 was just released, and it added a neat feature to the suggestions that I really appreciated. You can now add your own placeholders for code.  How does this work? Let me show you.

Let’s imagine that I want to quickly view a table and update a column. I build a snippet like this:

2015-09-09 15_01_15-SQL Prompt - Edit Snippet

Notice that I’ve added “tblnm” as a placeholder inside of two dollar signs. This is my custom value. It’s not a parameter, but rather a placeholder.

I can set a default value if I’d like.

2015-09-09 15_01_10-SQL Prompt - Edit Snippet

Now when I start typing, I see my snippet appear.

2015-09-09 15_01_24-ObjectDefinitionBox

I hit tab and then I get my snippet. The cursor is where I specified with the $CURSOR$ placeholder that was built in. However my custom placeholder has a list of the objects available that fit here.

2015-09-09 15_01_32-SQLQuery1.sql - aristotle.sandbox (ARISTOTLE_Steve (67))_ - Microsoft SQL Server

If I select one, I get my code. Note that the default value was inserted above.

2015-09-09 15_01_45-SQLQuery1.sql - aristotle.sandbox (ARISTOTLE_Steve (67))_ - Microsoft SQL Server

Very cool.

Now I can adjust my snippets with my own placeholder that makes sense to me, and have intellisense pop up right away.

Another keystroke or two saved.

About way0utwest

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