--(注释)(Transact-SQL)

表示用户提供的文本。可以将注释插入单独行中、嵌套在 Transact-SQL 命令行的结尾或嵌套在 Transact-SQL 语句中。服务器不对注释进行计算。

主题链接图标Transact-SQL 语法约定

语法

-- text_of_comment

参数

text_of_comment

包含注释文本的字符串。

备注

将两个连字符 (--) 用于单行或嵌套的注释。用 -- 插入的注释由换行符终止。

注释没有最大长度限制。

ms181627.note(zh-cn,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 帮助