SQL SERVER – Upper Case Shortcut SQL Server Management Studio

Few days ago, I received code which is very similar to code shown below.
select *
from Sales.SalesOrderDetail
where ProductID > 777

I am not the guy who go crazy for formatting but I do appreciate proper coding. I like if the code was formatted like below.

FROM Sales.SalesOrderDetail
WHERE ProductID > 777

The fastest way one can do this in SSMS is either search and replace or using SSMS short cut to covert keywords to upper case.

What I do is I select the word and hit CTRL+SHIFT+U and it SSMS immediately changes the case of the selected word. Similar way if one want to convert cases to lower case, another short cut CTRL+SHIFT+L is also available.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

34 thoughts on “SQL SERVER – Upper Case Shortcut SQL Server Management Studio

  1. Hi Pinal,

    I tried the way and thanks for the shortcut, and CTRL+SHIFT+U is working fine but CTRL+SHIFT+L is not working for me to change the cases to lower case, it simply removes the whole line in query analyzer,

    I am having SQL SERVER 2008 in MS 2003 server.



  2. Sir u are simply great….Thank u so much for this shortcut….
    One thing i wanna ask u… i ve used the Redgate toolbelt for using intellisense in sql server 2005….There is an option for formatting the code automatically….is there some similar in built option in sql server 2008


  3. A much easier and faster way is to use the SSMS Tools Pack, it includes a query text formatting procedure that you can configure (shortcut CTRL+SHIFT+F) and it can format in uppercase (or lowercase) all keywords of your query in one pass.


    This tools pack come with a lot of other features but I only use it for the text formatting shortcut and I wouldn’t live without it.


  4. What SSMS should have is ability to uppercase only the keywords. This should not be hard for an IDE and I hope we get it in the next version. In the meantime SSMS Tools rocks.


  5. I respectfully ask why it is necessary to use upper case for keywords when keywords automatically appear in blue.

    I understand that many developers use upper case for keywords but I also know many developers who use lower case.

    Is this issue not simply a matter of personal style?

    Best wishes,



    • Mr. Keith,
      Upper case and Lower case are needed to be taken care in the cases like you are supporting the data to be entered and read in two different languages for one application.
      In my case, we made an application for our client which accepts ENGLISH and ARABIC.
      If we wouldn’t use “UPPERCASE” (for table names,column names) that will not execute the query at all. This is one case where we need to give importance for case sensitivity.


  6. There’s one cool feature if u have quickly change the case of block of text in multiple line.
    Simply hold down “Alt” key and make a rectangular selection. Now the you quickly modify the case for the text selected in the block.


  7. First time user can go with SSMS Menu and look there, shortcuts are mentioned for every menu command. Try to remeber that and keep a pratice using them.

    You will find lots of shorcut in SSMS menus.


  8. Pingback: SQLAuthority News – A Monthly Round Up of SQLAuthority Blog Posts Journey to SQL Authority with Pinal Dave

    • Hello Friends,
      Does any Know KeyBoard Shortcut to get Dependencies of a selected Table in Query Analyser Window.

      Alt – F1 Shows only Constraints, index , keys so.. on.

      But i need to view available Procedures and triggers Related that Table.

      This Option is available in Object Explorer Window on Right Click and Select ‘View Dependencies’. But this method consumes lot of time in finding out a specific table in object Explorer table List Tree.


  9. in response to Keith’s post – the reason that upper casing is used is that .SQL files can be saved and edited in a text editor such as notepad – this won’t pick up the formatting and automatically hightlight keywords in blue – if they’re in upper case thay stand out.


  10. I like mine the other way around. And when is sql going to start allowing the from statement to be placed first? I think ansi sql needs to incorporate this because it would really make intellisence a lot easier.


    • I start with a generic statement:
      SELECT *
      FROM table t

      After that, I just go back and write column names with the table alias (otherwise it is a huge list of columns to choose from):

      SELECT t.col1, t.col2
      FROM table t


  11. Thank you for the shortcuts. I went the other way around, going crazy with all the caps that I had to convert it all to lower case and make it indent. Anyway, thanks for the CTRL-SHIFT-L, that works great.


  12. Pingback: SQL SERVER – Weekly Series – Memory Lane – #037 | Journey to SQL Authority with Pinal Dave

  13. Hi,
    You are not just concentrating on queries but also concentrates on small things like this. Continue your great work. You have saved my time


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s