Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to: Databricks SQL Databricks Runtime
Comments are useful for documenting SQL code and for temporarily disabling SQL code.
You can add comments to SQL code before, after, and within statements. Comments are ignored by Azure Databricks unless they are recognized as hints.
The following forms of comments are supported:
Simple comments are used to cover an entire line of text or the remainder of a line of text starting with --
-- text
text
: Any text excluding an end-of-line (EOL) character such as \n
.> -- This is a comment
> SELECT 1; -- This is also a comment
1
> SELECT -- This is a comment
1;
1
> SELECT -- Comments are not limited to Latin characters: 评论 😊
1;
1
> SELECT '-- This is not a comment';
-- This is not a comment
> SELECT -- This is a bad comment because the "one" should be on the next line... 1
Syntax error
> SELECT -- this is a bad
comment because it contains an EOL character
1;
Syntax error
Bracketed comments are used to cover multiple lines of text or a portion of a line of text.
bracketed_comment
/* text [ bracketed_comment [...] ] text */
text
: Any text including end-of-line (EOL) characters, excluding /*
and */
.> /* This is a comment */
> SELECT 1; /* This is also a comment */
> SELECT /* This is a comment
that spans multiple lines */ 1;
> SELECT /* Comments are not limited to Latin characters: 评论 😊 */ 1;
> SELECT /* Comments /* can be */ nested */ 1;
> SELECT /* Quotes in '/*' comments "/*" are not special */ */ */ 1;
> /* A prefixed comment */ SELECT 1;
> SELECT '/* This is not a comment */';
/* This is not a comment */
Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register today