Is there a way to create collapsable regions in the SQL script file like we create in VS using
#region ..... #endregion
?
--EDIT--
Script file contains DDL statements like Alter Table and Alter View etc. and i want to group them in regions like "Table Related Statements" "View Related Statements" etc.
Use SQL Server Management StudioRight-click Databases, and then select New Database. In New Database, enter a database name. To create the database by accepting all default values, select OK; otherwise, continue with the following optional steps. To change the owner name, select (...) to select another owner.
Yes, with SSMS Tools Pack
Regions and Debug sections
Regions behave in the same way as in Visual Studio. You can collapse them and expand them. Debug sections are sections that get commented when you change your script to Release configuration. A debug section is also a collapsable region. If you deploy a script in debug mode with added debug sections it will fail when run from SSMS without SSMS Tools Pack installed. You can of course comment those sections yourself by simply searching for start and end text of the debug sections
No, but you can simulate it in SSMS by using begin..end
blocks as follows:
--Region 1
begin
--Do Something
end
--Region 2
begin
--Do Something Else
end
The begin..end
pair is collapsible.
EDIT:
This only works for DML scripts. DDL scripts are more picky as many statements require to be the first in the batch (original question did not state DDL use.)
I don't think there's a way to do this within one script file for DDL - you're into breaking down the script into smaller scripts or stored procs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With