Quick Tips–SQL Prompt Formatting

I love SQL Prompt, and think it’s a great productivity tool. Even before I worked at Red Gate, I love the tool and had a copy before Red Gate bought the technology from the original developer. Recently I’ve run into a few people that weren’t aware of some of the ways in which it can help you. This is a quick look at one of the ways I use SQL Prompt.

Ugly Code

It’s often that I’ll get code submitted at SQLServerCentral, or it will come in a demo from Red Gate, and it will look something like this:

prompt_af

This is actually code from Microsoft in the AdventureWorks 2008 sample database. It’s ugly and hard to read. In fact, I struggle trying to interpret code when I see it like this.

Reformatting

One of the things I probably do most often, after SSF, is reformat code so that I can read it. I have a few settings I prefer, but to apply them, I’ll click CTRL+K, then CTRL+Y and my code will get fixed.

prompt_ag

If I have invalid SQL, Prompt will throw an error and there will be a squiggle line under the offending sections. If I only want to reformat a portion of code, I can highlight it before hitting the shortcut.

Unknown's avatar

About way0utwest

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

7 Responses to Quick Tips–SQL Prompt Formatting

  1. lcarpay@emscard.com's avatar lcarpay@emscard.com says:

    I could never reach my speed of programming without SQL-Prompt. It … IS … a great tool!

    Like

  2. Bob Mathews's avatar Bob Mathews says:

    This truly is a great tool. I would never want to code with out it. The IntelliSense is so intuitive and the automatic formatting (Uppercase key words as well as a host of other features) make this well worth it. The only downside it that it becomes a crutch. You become “lost” without it and become dependant on it to suggest table/field names.

    Like

  3. Larry's avatar Larry says:

    I totally agree! One of the best productivity tools we use.

    Like

  4. Jason's avatar Jason says:

    I love SQL Prompt, but not for its formatting. There aren’t enough options to customize the formatting for my needs, But the Snippets and IntelliSense (especially across linked servers) make it such a useful tool..

    Like

Comments are closed.