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

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

Transact-SQLTransact-SQL 程式碼片段是範本,當您在 Transact-SQLTransact-SQL 查詢編輯器中撰寫新的 Database EngineDatabase Engine 陳述式時可將它做為起點。A Transact-SQLTransact-SQL code snippet is a template you can use as a starting point when writing new Transact-SQLTransact-SQL statements in the Database EngineDatabase Engine Query Editor.

插入程式碼片段Inserting Snippets

您可以使用 [插入程式碼片段] 功能表開啟分類的程式碼片段清單,從中選擇。You can use the Insert Snippet menu to open a categorized list of snippets to choose from.

Transact-SQLTransact-SQL 程式碼片段包含取代點:建議與該點相關語法的文字。 snippets contain replacement points: text that suggests the syntax relevant to that point. 例如,CREATE TABLE 程式碼片段有資料表名稱、資料行名稱和資料行資料類型等元素的取代點。For example, the CREATE TABLE snippet has replacement points for elements such as the table name, column names, and column data types. 在插入程式碼片段之後,您必須變更取代文字,以形成有效的 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.

藉由使用插入程式碼片段功能表,插入程式碼片段Inserting a Snippet by Using the Insert Snippet Menu

  1. Database EngineDatabase Engine 的 [查詢編輯器] 視窗中,將游標放在您想要插入 Transact-SQLTransact-SQL 程式碼片段的位置。In the Database EngineDatabase Engine Query Editor window, put the cursor where you want to insert the Transact-SQLTransact-SQL snippet.

  2. 使用下列三種方法之一啟動程式碼片段選擇器工具提示:Launch the snippet picker tooltip in one of three ways:

    • 按下 CTRL+K、CTRL+X。Press CTRL+K, CTRL+X.

    • 在 [編輯] 功能表上,指向 [IntelliSense],然後按一下 [插入程式碼片段]。On the Edit menu, point to IntelliSense, then click Insert Snippet.

    • 按一下滑鼠右鍵,然後從快速鍵功能表中選取 [插入程式碼片段] 命令。Right-click the mouse and then select the Insert Snippet command from the shortcut menu.

  3. 按兩下程式碼片段,或從程式碼片段選擇器中選取程式碼片段,然後按 TAB 或 ENTER。Double-click the snippet, or select the snippet from the snippet picker and then press TAB or ENTER.

另請參閱See Also

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