We help IT Professionals succeed at work.

T-SQL "Code Wrapping" in SSMS 2012

ttist25
ttist25 asked
on
Hey there -

I'm writing a lot of one off scripts in SSMS during analysis of new datasets.  I'm trying to figure out a way to code wrap regions in SSMS.  I haven't found anything in searches other than plugin/addon stuff which I'd like to avoid.  

Does anyone have any tricks that would allow me to create a collapsable "region" anywhere in my code in SSMS.  

Something like:

SELECT
#RegionFields
this,
that,
the,
other
#/EndRegionFields
FROM
MyTable
WHERE
#RegionCriteria
this=that and
deez=doze and
so=on and
so=on
#EndRegionCriteria

So that anything between the #Regions would be collapsable.  

TIA!
Comment
Watch Question

Pawan KumarDatabase Expert
Awarded 2016
Top Expert 2016

Commented:
In SQL Server we do not have anything like that.

#Region
....
#EndRegion

we have this in .NET

If we long code SQL automatically shows - ( hyphen )

click on that SQL collapse the long code.
Database Expert
Awarded 2016
Top Expert 2016
Commented:
Example of above comment. This is how you toggle the outlines.

EE.jpg

Author

Commented:
Thank you Pawan!

That isn't exactly what I had envisioned but it definitely gets the job done.  

Thanks!