Transact-SQL 参考

--(注释)

表示用户提供的文本。可以将注释插入单独行中、嵌套(只限 --)在 Transact-SQL 命令行的末端,或者 Transact-SQL 语句中。服务器不对注释进行评估。两个连字符 (--) 是 SQL-92 标准的注释指示符。

语法

-- text_of_comment

参数

text_of_comment

包含注释文本的字符串。

注释

将 -- 用于单行或嵌套的注释。用 -- 插入的注释由换行字符分界。

注释没有最大长度限制。

说明  在注释中包含 GO 命令会生成一个错误信息。

示例

下面的示例使用 -- 注释字符。

-- Choose the pubs database.
USE pubs
-- Choose all columns and all rows from the titles table.
SELECT *
FROM titles
ORDER BY title_id ASC -- We don't have to specify ASC because that
-- is the default.

请参见

/*...*/(注释)

控制流语言

使用注释