問題描述
有沒有辦法像我們在 VS 中創建的那樣在 SQL 腳本文件中創建可折疊區域#region ..... #endregion
?
Is there a way to create collapsable regions in the SQL script file like we create in VS using
#region ..... #endregion
?
--編輯--
腳本文件包含 DDL 語句,例如 Alter Table 和 Alter View 等,我想將它們分組到表相關語句"查看相關語句"等區域中.
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.
推薦答案
是的,使用 SSMS 工具包
區域和調試部分
區域的行為方式與 Visual Studio 中的相同.您可以折疊它們并展開它們.調試部分是在您將腳本更改為發布配置時獲得注釋的部分.調試部分也是一個可折疊區域.如果在調試模式下部署腳本并添加調試部分,則在未安裝 SSMS 工具包的情況下從 SSMS 運行時,腳本將失敗.您當然可以通過簡單地搜索調試部分的開始和結束文本來自己評論這些部分
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
這篇關于數據庫 - 如何在 TSQL (SQL Server 2008) 中創建區域的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!