views:

527

answers:

3

A new feature in SQL Server Management Studio 2008 is 'outlining' (the ability to collapse regions). It is awesome. However, by default all regions are expanded. I can't seem to find a way to 'collapse all' (also called 'toggle outline' in Visual Studio). Is anyone aware of a way to do this? I've been tasked with reviewing a 3,000 line stored procedure, and collapsing regions one-by-one is cumbersome.

A: 

Edit | Outlining | Collapse To Definitions

or

Ctrl+m, CTRL+o

Hogan
Unfortunately, while your suggestion works in Visual Studio, it does not work in SQL Server Management Studio 2008.
Shawn
+1  A: 

It appears this feature does not exist. It has been recommended to Microsoft. I suggest voting it up; http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=368542

As a work-around, I'm using Notepad++ to edit locally. Its region identification isn't as good, but it's better than nothing.

Shawn
A: 

A workaround is to use BEGIN and END.

BEGIN -- comment on/explain the region/outlined section

/*

TSQL goes here

*/

END

You will then be able to collapse the BEGIN.

Willem Jac
Thanks for the creative answer. However, doing this only creates a single collapsed 'root' section. I was looking for a way to collapse all sections down so it was easier to read.
Shawn

related questions