Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
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.
Transact-SQL Syntax Conventions
Syntax
-- text_of_comment
Arguments
- text_of_comment
Is the character string that contains the text of the comment.
Remarks
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.
Note
A GO command included within a comment generates an error message.
Examples
The following example uses the -- commenting characters.
-- 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
See Also
Reference
/*...*/ (Comment) (Transact-SQL)
Control-of-Flow Language (Transact-SQL)