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.
-- text_of_comment
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.
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.
/*...*/ (Comment) | Control-of-Flow Language |
Using Comments |