5

My personal opinion is that C style comments should not be used by sql developers.

The problem with C Style comments is, that they do not nest.

C Style comments are one of the lifesavers for the support when they have to do some ad hoc corrections in stored procedures, but that only works well, when they don't have to fight with existing C comments.

2 Answers 2

3

I never use C-style comments in SQL code. First off, Management Studio gives a very easy way to comment out blocks of code with SQL-style commenting, and just as easy to uncomment it out.

And not to mention if another person opens a SQL script file not in SSMS, C-style comments have a tendency to be elusive and the commented out code doesn't look so commented.

Just my opinion, but I stay away from C-style commenting. No gain.

0

SQL style comments are easy to do in Management Studio (and Visual Studio) using keyboard shortcuts -> standard are ctrl+K+C (ctrl+K+U to uncomment). The C standard comments are not so easy to write at once for many lines.

My opinion is that SQL style comments are evil when used in traceable code (they cause trouble when reading user code in traces or system views).

3
  • 3
    C-style comments are /* ... */. Using Ctrl+K+C in SSMS generates SQL-style comments --.... Oct 17, 2011 at 15:21
  • Whoa..I've replaced one with the other :-). Now what to do :-? ? .. Remove the stupid answer or edit it so that it will be corrected?
    – Marian
    Oct 20, 2011 at 14:44
  • Just correct it so it's clear that it's SQL-style (and not C-style) comments that are easy to generate. How? Using the shortcuts you described. Also use the <kbd> markup tags to highlight the key presses like <kbd>this</kbd> (should work in your answer). Oct 20, 2011 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.