Uppercase or lowercase T-SQL keywords

I have been rethinking using uppercase letters for T-SQL keywords. Readability research shows that uppercase keywords are harder to read and experience shows they are harder to type. Is it just tradition that keeps T-SQL developers uppercasing keywords?

After searching the internet, the only argument I found for uppercasing keywords is the traditional one that it makes keywords easier to discern from other constructs. However, the days of green screen terminals are long gone. Modern T-SQL editors automatically color code various language constructs so using case to do it seems an unnecessary and harmful step.

All this would be just an idiosyncratic preference of some Microsoftie but I am thinking about the formatting options and defaults for automatically generated T-SQL. Any feedback is welcome.

This posting is provided "AS IS" with no warranties, and confers no rights.

Comments

  • Anonymous
    September 15, 2005
    The comment has been removed
  • Anonymous
    September 15, 2005
    The comment has been removed
  • Anonymous
    September 16, 2005
    I think I started off my programming against t-sql pretty much doing it First Character Upper case lower case everything else. Lately though since .net I have been using upper case more. Especially when I have my sql command and dynamic parameters set in code. For me it is more readable. Since even in VS a string is a string and is only one color. Every not and then I still slip and it is camel cased, but I do still find it easier to read when the SQL Command are all Upper cased.
  • Anonymous
    September 18, 2005
    The comment has been removed
  • Anonymous
    September 19, 2005
    > Readability research shows that uppercase keywords are harder to read

    Those studies are probably to do with standard text, rather than programming languages.

    I suspect that uppercase keywords in SQL make the text easier to read, since they highlight the inherent structure of SQL (natual language lacks this 'inherent structure').
  • Anonymous
    November 30, 2005
    I wrote program which ease you of UpperCase SQL keywords. It trasforms all keywords you type to uppercase on the fly.
    You can read about it here: http://sql.yurko.ru






  • Anonymous
    September 09, 2006
    When do I use upper case or lower case when referring to mother and father?
  • Anonymous
    September 24, 2009
    Hi,Having used various 4GLs for quite a few years before getting into SQL Server coding, I find thatthe most readable code is gained by putting keywords into lower case and table/columnnames into upper case.We all know what the relatively common main keywords in T-SQL mean and where they fit into a block, particularly if we format uisng indentation consistently.  What really distinguishes one block of code from another within more complex stored procedures or functions is the Table and Columns which are the subject of the relatively common T-SQL syntax.  My experience is that the names and columns are what really need emphasising in the code.Just my few pennies worth..Michael
  • Anonymous
    June 08, 2010
    I agree with Micheal, after looking at enough T-SQL with both keyword in UPPER and lower case, it is a lot easier to read when it's lower case
  • Anonymous
    January 21, 2011
    The comment has been removed