Export (0) Print
Expand All
ABS
ALL
AND
ANY
AVG
bit
COS
COT
DAY
EXP
GO
IN
LEN
LOG
MAX
MIN
NOT
OR
PI
SET
SIN
STR
SUM
TAN
USE
VAR
Expand Minimize

-- (Comment)

SQL Server 2000

Indicates user-provided text. Comments can be inserted on a separate line, nested (-- only) at the end of a Transact-SQL command line, or within a Transact-SQL statement. The comment is not evaluated by the server. Two hyphens (--) is the SQL-92 standard indicator for comments.

Syntax

-- text_of_comment

Arguments

text_of_comment

Is the character string containing the text of the comment.

Remarks

Use -- for single-line or nested comments. Comments inserted with -- are delimited by the newline character.

There is no maximum length for comments.

Note  Including a GO command within a comment generates an error message.

Examples

This example uses the -- commenting characters.

-- 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.

See Also

/*...*/ (Comment)

Control-of-Flow Language

Using Comments

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft