How to ... Use code regions and outlining

Outlining

Outlining provides a way to collapse blocks of code into summary sections. Outlining is available for multi-line comments and code regions, and is visually represented by a vertical line indicating the start and end of the outlined block, and a +/- symbol that allows you collapse or expand the block.

Click on the - symbol to collapse a block ...

... and + symbol to expand it.

You can collapse and expand all outlining by using the Collapse All and Expand All commands on the Outlining menu from the main Edit menu.

Code Regions

Code regions are a special type of outlining allowing you to split your SQL statements into distinct blocks of related functionality. These can be collapsed or expanded to allow you concentrate on a section of code without the distraction of the whole query.

To create a region you use a paired set of comments:

Anything between the comments is enclosed by the region. It is often useful to type some additional information so that the region can easily be identified when collapsed.

Note that a region is just a special comment so if you use the code in an application other than SQL Visualizer, such as Query Analyzer or OSQL, the region will just be treated as a comment and have no impact on its execution.

When a region has been collapsed it still actively contains the code so you can select a collapsed region and still execute it.