Tip for SQL Server Management Studio

You know the feeling when you discover a feature in software that you use daily for many years, and could have made your work so much simpler had you known about it earlier? I recently discovered such a feature in Microsoft SQL Server Management Studio (SSMS).

Michael Zilberstein—a member of the Israeli SQL Server User Group—delivered a presentation on statistics in Microsoft SQL Server. At some point I notice that he highlights a piece of code that is commented out, without the comments, and runs the code. I was pleasantly surprised to know that this was possible, since I remembered all the times that I had to uncomment before I could run a piece of code that was commented out, or when I just wanted to copy that code without the comments. So, the trick is to simply press the Alt button, and then highlight the rectangle you like. Here’s a screenshot that demonstrates a highlighted rectangle of code:

Now you can either run or copy the highlighted code.

I figured that if I’ve been working for years with SSMS and haven’t known about this features, many other programmers probably don’t know about it as well and will find it useful.




Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.