SQL comment is a text, added to the code to provide information about what the code is doing. Comment is ignored by the SQL engine when the code is run. The purpose of comment is to help others to understand your code better.
Single-line comment starts with two hyphens/dashes ( -- ). Anything after the two hyphens/dashes on that line is ignored. For example :
SELECT * -- this is a comment FROM [Person].[Address];
Multi-line comments starts with /* and end with */. Anything between these two symbols is ignored. For example :
/* This is a multi-line comment */ SELECT * FROM [Person].[Address];
To comment in SQL, use "--" for single-line comments or "/* */" for multi-line comments.
There are two types of comments in SQL: single-line comments and multi-line comments.
The comment structure in SQL is either "--" for single-line comments or "/* */" for multi-line comments.
To comment on a single line in SQL, use "--" followed by your comment.