

The double dash and end of line pair is part of the ANSI/ISO standards. The bad news and SQL, as far as I’m concerned, is that people don’t put in comments 🙁


Though it might not be the worst idea either - I’d take consistency + no havoc over choice + havoc when it came to my SQL. I probably wouldn’t go so far as to ask MS to officially deprecate line comments, because even if they did they wouldn’t actually implement it as a breaking change (they simply don’t do that - that’s what CUs are for!) and VS proper (eventually) introduced a block comment shortcut in 2019. * ask MS to change Ctrl-K/Ctrl-C and Ctrl-K/Ctrl-U to use block comments instead of line comments, or an option to choose which, or a separate block comment/uncomment shortcut * ask MS to change the default value of the SSMS option to preserve linebreaks on copy/save * file a bug report with the folks that make your monitoring tool or whatever if it does this, especially if it’s claiming to be a parser What I would say, though, is to follow the usual steps after implementing a workaround and at least attempt to address the root cause or implement more systemic workarounds: I’ve never had SQL Prompt choke on line comments, and I’ve never seen a DMV/DMF remove linebreaks (the SSMS results grid removes them, which is why I rap the knuckles of people I see copying out of the results grid for anything important - there’s an SSMS option to preserve linebreaks when copying and saving, but it isn’t on by default and I treat SSMS results as a visualisation and nothing more).īut this is an admirably simple workaround for problems that do exist (which includes people assuming SSMS hasn’t mangled their results, which is a fairly reasonable if sadly incorrect assumption to make).
