Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|improve this answer

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).

share|improve this answer
C-style comments are /* ... */. Using Ctrl+K+C in SSMS generates SQL-style comments --.... – Nick Chammas Oct 17 '11 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 '11 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). – Nick Chammas Oct 20 '11 at 14:58
@Nick: done that, thanks for the notice. – Marian Oct 21 '11 at 8:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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