-- (註解) (Transact-SQL)

指出使用者提供的文字。註解可以插入個別行中、巢狀放在 Transact-SQL 命令列尾端,或放在 Transact-SQL 陳述式內。伺服器不會評估註解。

主題連結圖示Transact-SQL 語法慣例

語法

-- text_of_comment

引數

text_of_comment

這是包含註解文字的字元字串。

備註

單行註解或巢狀註解使用兩個連字號 (--)。新行字元會終止利用 -- 插入的註解。

註解沒有最大長度。

ms181627.note(zh-tw,SQL.90).gif附註:
包括在註解內的 GO 命令會產生錯誤訊息。

範例

下列範例會使用 -- 註解化字元。

-- Choose the AdventureWorks database.
USE AdventureWorks;
GO
-- Choose all columns and all rows from the Address table.
SELECT *
FROM Person.Address
ORDER BY PostalCode ASC; -- We do not have to specify ASC because 
-- that is the default.
GO

請參閱

參考

/*...*/ (註解) (Transact-SQL)
流程控制語言 (Transact-SQL)

其他資源

使用註解

說明及資訊

取得 SQL Server 2005 協助