SQL SERVER MANAGEMENT STUDIO 2008 (comment button)
has changed from the SQL SERVER MANGEMENT STUDIO 2005 (comment button)
Last Updated: 2009-02-01
I ALSO POSTED THIS AT:
I did a lot of testing and comparison between the two studio products:
BOTTOM LINE: Microsoft changed the behavior of the COMMENT BUTTON (--) "--"
SUMMARY:
1>TABS ARE NO LONGER CONSIDIRED IMPORTANT if you do not have at least one line which has a character in the first column.
2>EMPTY LINES ARE NO LONGER CONSIDED IMPORTANT...Microsoft does not think spacing inside of a comment section is important.
Upon further research of how the comment button works differently than it did in 2005...which I really do not like.
COMMENT BUTTON IN SQL 2005:
LEFT JUSTIFIES ALL COMMENTS.....WHETHER THE ARE TABBED OR WHAT.. THE FIRST TWO CHARACTERS IN THE LINE will become -- . EVEN WHEN no characters are placed on the line which is being commented. The two hyphens "--" will still appear and add consistency to a comment section inside of a sql stored procedure.
So for example: if the you hightlighted 3 full lines of code to comment inside a stored procedure(or simple query) it would left justify the comment "--" lines. If one of those lines did not have any text on it. SQL SERVER Managment studio 2005 would still commented as I would anticipate.
EXAMPLE1..studio2005> Click the comment button
-- TESTLINE1
--
-- TESTLINE2
EXAMPLE2..studio2005> Click the comment button
-- TESTLINE1
WHAT CHANGED IN SQL 2008 management studio:
1> Left justification will not always happen. You must have a character in the left most column in one of the lines highlighted.
EXAMPLE> if 3 lines of text all started with 3 TABS. the comment characters (--) would appear right before the first character after the 3 tabs... In other words SQL 2008 left justifies the character in reference to the left most character of the lines highlighted. SO to have the "COMMENT BUTTON" place the (--) character in the first position of every line... You must highlight at least one line which has the a character in the first column...
2> SQL SERVER 2008 management studio no longer comments blank lines.....WHAT IS UP WITH THAT...in sql server 2005. if you highlighted even 1 blank line...it would comment it. SQL SERVER WILL NO LONGER DO THIS...in other words the SERVER TEAM does not think you should have empty lines in your comments to make it more readable.
EXAMPLE1..studio2008> Click the comment button
-- TESTLINE1
-- TESTLINE2
EXAMPLE2..studio2008> Click the comment button
-- TESTLINE1
I BELIEVE in the worst case scenario: THIS SHOULD BE A PREFERENCE IN HOW THE BUTTONS IS SETUP. I BELIEVE in the best case scenario. It should react the same way as did studio 2005.
After all, if you wanted the "COMMENTS" to appear in the middle of the page. You could use the tab button to push them over.. THIS NEW STYLE MICROSOFT ESTABLISHED...WILL REALLY START TO MAKE SLOPPY COMMENT SECTION.
search engine reference:
comments in studio 2008
-- does not work in studio 2008
comment button does not work like studio 2005
comment button needs more work
microsoft sql comments have changed in sql 2008 management studio
microsoft sql 2005 comments buttons work diffently than in SQL 2008
microsoft sql 2008 comments buttons does not work as intended
differences between -- in sql 2005 when compared to -- in sql 2008
-- comments are different when using sql 2008 to manage sql 2005 database stored procs
Stored procedure comment button is different in sql 2008
why did microsoft change the comment button in sql 2009 enterprise sql studio