Code commeting is the one of the most common tasks developers perform. There are two major reasons why developer comment code. 1) During Debug 2) Documenting the code. While debugging the T-SQL code I have often seen developers struggling to comment code. They spend (or waste) more time in commenting and uncommenting than doing actual debugging of the procedure. When I see developer struggling to comment the code I feel little uncomfortable as commenting should be a very easy task over. Today we will see three quick method to comment T-SQL code in Query Editor.
There are three different method to comment and uncomment statements in SQL Server Management Studio
Using Keyboard Shortcuts
Using Tool Bar
Using Menu Bar
Method 1: Using Keyboard Shortcuts
Commenting the statement – CTRL+K, CTRL+C
Commenting the statement – CTRL+K, CTRL+U
Method 2: Using Tool Bar
Using Tool bar buttons. (See Video)
Method 3: Using Menu Bar
Commenting the statement – Menu Bar >> Edit >> Advanced >> Click on Comment Selection.
Unommenting the statement – Menu Bar >> Edit >> Advanced >> Click on Uncomment Selection.
More on Importing CSV Data:
Two Different Ways to Comment Code – Explanation and Example
I encourage you to submit your ideas for SQL in Sixty Seconds. We will try to accommodate as many as we can.
If we like your idea we promise to share with you educational material.
Reference: Pinal Dave (http://blog.sqlauthority.com)
Filed under: Database, Pinal Dave, PostADay, SQL, SQL Authority, SQL in Sixty Seconds, SQL Query, SQL Scripts, SQL Server, SQL Server Management Studio, SQL Tips and Tricks, T SQL, Technology, Video