SQL SERVER – Tricks to Comment T-SQL in SSMS – SQL in Sixty Seconds #019 – Video

SQL SERVER - Tricks to Comment T-SQL in SSMS - SQL in Sixty Seconds #019 - Video 60

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

Uncommenting 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:

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 (https://blog.sqlauthority.com)

Database, SQL in Sixty Seconds, SQL Scripts, SQL Server Management Studio
Previous Post
SQL SERVER – Monitoring SQL Server Database Transaction Log Space Growth – DBCC SQLPERF(logspace) – Puzzle for You
Next Post
SQL SERVER – Retrieve SQL Server Installation Date Time

Related Posts

3 Comments. Leave new

  • Till now I have used the first two methods only thanks for the 3rd method

  • Pinal :
    Thanks for the 3rd trick on commenting and un-commenting methods .

  • Joe Terrapin
    July 5, 2012 11:16 am


    from my observations since becoming an avid watch and learn not to mention savvy individual we are primarily working with the MS SQL system?

    or mySQL, postgresql, tivoli frameworks? and other sql server wares included?

    when i discovered sql i was totally lost with it a few years back but using the “my” version since build 5.0.37, including all 5.1 builds and currently 5.5.24 with apache modules. i used to use IIS7 but it was(IMO) a migraine headache and stressful(IMO) so i reverted back to apache and i do pretty good with mySQL for someone that wings it and learns it as he goes so can someone if not yourself ever so kindly bring me up to par/speed with heresay, Please?

    thanks. love this forum/blog. glad i found it and im sure i can get something out of it that i may need and hopefully can contribute something in the not so distant future. happy indpendence day evening 2012 and many blessings….



Leave a Reply