How to make SSMS upper case keywords

No, Management Studio does not have this native functionality in any version from 2005 -> 2016 CTP 3.2. You may want to check out 3rd party add-ins, like Mladen Prajdić's SSMS Tools Pack or Red-Gate's SQL Prompt, both of which have the capability to format a block of code, including automatically upper-casing keywords. However I don't know of any tool that will do this automatically as you type.

For me, I have been doing it so long, it just comes naturally, and not pressing Shift would actually slow me down. When I get someone else's code where the keywords are lower case, I highlight either the whole block or the offending sections, and hit Ctrl+Shift+U. If I have to highlight the whole section, I then go in to the object / column names and use IntelliSense to case them correctly (I have a real hang-up about ensuring that all keywords are upper case and all entity names match the metadata exactly, because you never know when your code will be deployed to a case sensitive collation).


In addition to solutions that are already mentioned, I'd suggest using ApexSQL Refactor - a free SSMS and Visual Studio add-in.

ApexSQL Refactor can help you create your own SQL formatting standards. It can be used to distribute and enforce SQL formatting rules among team members. To perform capitalization formatting, it is enough to:

  1. Download ApexSQL Refactor
  2. Launch your SQL Server Management Studio or Visual Studio’s and click ApexSQL Refactor on the Main menu
  3. From the ApexSQL Refactor menu, click the Format T-SQL code option
  4. Select Formatting options Set the specific option (Capitalization)
  5. Preview the option’s effect on the current query or a built-in example

Capitalization formatting Note: Before configuring capitalization standards, ensure your database doesn’t have case-sensitive collation. This can cause big problems when playing with capitalization.

If you wish to learn more, I suggest to read these 2 articles to see how capitalization is handled with ApexSQL Refactor:

  • http://solutioncenter.apexsql.com/sql-formatting-standards-capitalization-indentation-comments-parenthesis/
  • http://solutioncenter.apexsql.com/rules-of-sql-formatting-sql-naming-conventions-and-capitalization-rules/

One more very simple solution: use notepad++. Inside there is very good plugin called Poor man's sql formatter. The drawback is that you have to paste SQL inside the notepad++. But it is free.

There is also poorsql.com, but I did not try it.