Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

SQL Prompt Tips #2 - Casing Options

By Steve Jones,

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.

Setting Case

Many of us write code in a certain case. Some of us like UPPERCASE, some lowercase, and some mixed. SQL Prompt can help you quickly format the code the way you like it, based on your preferences.

The default for SQL Prompt is UPPERCASE. This means that if I start typing code, for example, I type "sel", you'll notice that SQL Prompt shows me the match of SELECT.

I can hit "Tab" and I'll see this:

If I continue typing, and add a "*" and then an "fr", I see this.

SQL Prompt notes that my preference is to have keywords in UPPERCASE and formats things appropriately. I can continue my query and note that all of the keywords are in upper case. I have refactored my code, and notice that the datatype is also in upper case. I typed all of the code in lower case, hitting Tab where SQL Prompt had correctly shown me the rest of the word I wanted to type.

This is controlled from the Options selection under the SQL Prompt menu.

When I select this item, I get a dialog containing all of the SQL Prompt settings. I can alter the case settings by selecting the Case item on the left, under the Format group.

Notice that I have three choices on the right. There are Reserved keywords, Build-in functions, and Built-in data types. I can set any of these individually, and for each I have a few choices.

These are the common choices that many programmers might choose, and I can select any of them. As I do, I can see the sample query below, change. For example, if I select lower case for reserved words, I'll see this:

However, I can also see what my current query looks like, but selecting the tab on the lower right. If I do that, and also change my data type to UpperCamelCase, I'll see this:

The code I wrote above is shown with my formatting options selected.

I would urge you to play around with these options, and ensure your code is formatted the way that is easiest for you to work with. The case doesn't change the logic, but most of us read and grasp the meaning of well formatted code more quickly, and thus, get more work done.

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.

Total article views: 199 | Views in the last 30 days: 1
 
Related Articles
FORUM

How to Change the default date format in sqlserver 2005

change the default Date format..

FORUM

datetime parameter format - Prompt page

year selection is difficult

BLOG

Changing the Command Prompt

I spend a lot of time at the command prompt and to be perfectly honest, I'm tired of looking at:  ....

ARTICLE

SQL Prompt Tips #1 - Selecting in the Object Explorer

A quick tip to help you get the most out of SQL Prompt

Tags
quick tips    
sql prompt    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones