DISQUS

Life is grand: Before the comma

  • Steve Crane · 3 years ago
    I think it's just a visual reminder that makes it less likely to forget to add a comma when appending or inserting to the column list.
  • Paul Watson · 3 years ago
    Possibly but after awhile I will become blind to commas preceding the value just as I am now blind to commas after the value.
  • Colin D. Devroe · 3 years ago
    It has more to do with the preference of the man or woman that built that specific function in SQL... I seriously doubt there are any good studies that show someone would be more likely to leave a trailing comma than a preceding one. But I've been wrong before.
  • Paul Watson · 3 years ago
    That is the likely explanation Colin but I'd hope the SQL team came to that coding style after some thought rather than just one coders preference.

    Anybody know if I can change the templates in Management Studio?
  • Michael Butler · 3 years ago
    I use the comma at the beginning of a line method too.

    a) because it makes it easy to comment out bits of code without having to alter the line above to remove the trailing comma

    for the similiar reasons my where clauses look like

    where
    a = b
    or
    c = d
    and
    a > b

    so much easier to comment out bits of code whilst debugging the query
  • Octavo · 3 years ago
    Meh, it should be quite clear why this was done this way:

    To screw with your mind. You will now spend at least 30 mins and one blog post wondering about why MS did this. Other people will attempt to justify it. In the end MS has achieved their sinister goals - massive producivity loss... :p
  • cleek · 3 years ago
    a leading comma makes it clear that the line is a continuation of the one above it.

    it's still ugly and wrong.