插入範圍陳述式 Transact-SQL 程式碼片段Insert Surround-with Transact-SQL snippets

本主題適用於: 是SQL Server是Azure SQL Database是Azure SQL 資料倉儲 是平行處理資料倉儲 THIS TOPIC APPLIES TO: yesSQL ServeryesAzure SQL DatabaseyesAzure SQL Data Warehouse yesParallel Data Warehouse

範圍陳述式片段是可讓您在 BEGIN、IF 或 WHILE 區塊中封入一組 Transact-SQLTransact-SQL 陳述式時當做起點使用的範本。A surround-with snippet is a template you can use as a starting point when enclosing a set of Transact-SQLTransact-SQL statements in a BEGIN, IF, or WHILE block.

插入範圍陳述式片段Inserting Surround-with Snippets

您可以使用下列其中一種方式來啟動範圍陳述式片段:透過鍵盤快速鍵、透過 [編輯] 功能表,以及透過內容功能表。Surround-with snippets can be launched by one of three ways: through a keyboard shortcut, through the Edit menu, and through the context menu.

在插入程式碼片段之後,您必須變更取代文字,以形成有效的 Transact-SQLTransact-SQL 陳述式。After inserting the snippet, you must change the replacement text to form a valid Transact-SQLTransact-SQL statement. 如需詳細資訊,請參閱 完成 Transact-SQL 程式碼片段For more information, see Complete Transact-SQL Snippets.

若要插入範圍陳述式片段To insert a surround-with snippet

  1. Database EngineDatabase Engine 的 [查詢編輯器] 視窗中,選取要包含在區塊中的陳述式集合。In the Database EngineDatabase Engine Query Editor window, select the set of statements to be included in the block.

  2. 使用下列其中一種方法來顯示範圍陳述式片段的清單:Use one of these three methods to display the list of surround-with snippets:

    • 輸入 CTRL+K、CTRL+S。Type CTRL+K, CTRL+S.

    • 在 [編輯] 功能表中,指向 [IntelliSense],然後選取 [範圍陳述式] 命令。From the Edit menu, point to IntelliSense, and then select the Surround With command.

    • 以滑鼠右鍵按一下選取的文字,然後從內容功能表中選取 [範圍陳述式] 命令。Right-click the selected text, and then select the Surround With command from the context menu.

  3. 使用滑鼠,從清單中選取片段的名稱 (BEGIN、IF 或 WHILE),或輸入片段的名稱並按下 TAB 或 ENTER。Select the name of the snippet (BEGIN, IF, or WHILE) from the list either by using the mouse, or by typing the name of the snippet and pressing TAB or ENTER.

另請參閱See Also

插入 Transact-SQL 程式碼片段Insert Transact-SQL Snippets