完成 Transact-SQL 程式碼片段Complete 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 陳述式。Once a Transact-SQLTransact-SQL code snippet has been inserted into a script, you edit the contents of the snippet to build a complete Transact-SQLTransact-SQL statement.

完成片段Completing Snippets

當您將 Transact-SQLTransact-SQL 片段加入至指令碼時,已插入的片段陳述式就會具有一個或多個反白顯示的取代點。When you add a Transact-SQLTransact-SQL snippet to your script, the inserted snippet statement has one or more replacement points, which are highlighted. 如果您將滑鼠指標停留在取代點上方,就會顯示工具提示,其中說明您可以指定的語法元素。If you rest your mouse pointer on a replacement point, a tooltip appears with a description of the syntax element you can specify. Database EngineDatabase Engine 查詢編輯器會將該片段視為不同於周圍的指令碼,直到您關閉來源檔案為止。The Database EngineDatabase Engine Query Editor recognizes the snippet as separate from the surrounding script until you close the source file. 此外,取代點會維持作用中狀態,直到您關閉來源檔案為止。The replacement points remain active until you close the source file.

您也可以將其他語法元素加入至片段所插入的範本程式碼。You can also add additional syntax elements to the template code inserted by a snippet. 例如,「建立資料表」片段範本會產生兩個資料行定義。您必須加入其他資料行定義,以便建立具有兩個以上資料行的資料表。For example, the Create Table snippet template generates two column definitions; you must add additional column definitions to create a table with more than two columns.

完成片段陳述式Completing the Snippet Statement

  1. 您可以使用 TAB 鍵,從某個取代點移至下一個取代點。Use the TAB key to move from one replacement point to the next. 您可以使用 SHIFT+TAB,移至上一個取代點。Use SHIFT+TAB to move to the previous replacement point.

  2. 按一下 CTRL+SPACE 叫用 IntelliSense。Click CTRL+SPACE to invoke IntelliSense.

  3. 從清單中選取項目,或輸入您選擇的取代項目。Select an item from the list, or type a replacement of your choice.

另請參閱See Also

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