Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

-- (Comment) (Transact-SQL)

Indicates user-provided text. Comments can be inserted on a separate line, nested at the end of a Transact-SQL command line, or within a Transact-SQL statement. The server does not evaluate the comment.

Topic link icon Transact-SQL Syntax Conventions

-- text_of_comment


Is the character string that contains the text of the comment.

Use two hyphens (--) for single-line or nested comments. Comments inserted with -- are terminated by the newline character.

There is no maximum length for comments.

A GO command included within a comment generates an error message.

The following example uses the -- commenting characters.

-- Choose the AdventureWorks database.
USE AdventureWorks;
-- Choose all columns and all rows from the Address table.
FROM Person.Address
ORDER BY PostalCode ASC; -- We do not have to specify ASC because 
-- that is the default.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft