Word Wrap is Your Enemy.
Why is this? If you use double-dash inline comments:
--This is a comment, at least it is supposed to be.
SELECT COL01, COL02, from dbo.mytable ...and your code gets opened in Notepad/Wordpad or some other editor that utilizes Word Wrap, it could look like this:
--This is a comment, or at least it is sup
posed to be
SELECT COL01, COL02, from dbo.mytable Good luck executing that code after it has been copy-pasted in this format into a query tool....something like "Improper syntax near 'posed'"
Even if you don't try to execute it, it can be difficult to read and troubleshoot when similar pieces of code are near each other and one line or the other is double-dash commented out.
So the hint to this is always, always, ALWAYS use star-slash comments /* */ even if your comment is short (even a single word) - it's not a bad habit to get into and doesn't cost you much (two extra characters) to protect you from this problem.
/*This is a comment, or at least it is sup
posed to be (and still is!)*/
SELECT COL01, COL02, from dbo.mytable Hope this helps!
No comments:
Post a Comment