Take the 2-minute tour ×
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. It's 100% free, no registration required.

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

2 Answers 2

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
3  
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

 
discard

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.