SSMS supports Outlining, the ability to selective hide blocks of code. This can be very useful, especially when working with large query files.

In the following screen shot, the indicated box is what you click to show / hide the selected region. In this case, if I were to click the box (which has a “-“ to indicate that it can be collapsed), the code would be collapsed to one line (for that region):

And the box changes to have a “+” to indicate that it can be expanded.

This can allow you to minimize code that you do not need to focus on, and to direct your attention to the remaining code.

All of the outlining options are available under an Outlining sub-menu off of the Edit menu:

Now if only there were a way to define regions of code like can be done in Visual Studio…

This post is for day twenty-two of my month-long blog series “A Month of SSMS Tips”. I have a landing page for the series at bit.ly/MonthOfSSMS. Please visit this page for an easy place to quickly view all of the other tips in this series.