Commenting out and uncommenting SQL code in the SQL and XQuery editor

While you are writing SQL statements in the SQL and XQuery editor, you can quickly comment out SQL code by using a command on the pop-up menu. You can use the same command to quickly uncomment SQL code.

Before you begin

The SQL script must be open in the SQL and XQuery editor.

About this task

You can comment out or uncomment a single line of code in an SQL statement, multiple adjacent lines of code, a complete SQL statement, or multiple adjacent SQL statements.

The syntax for a comment in a line of SQL code is a double hyphen (--) at the beginning of the line. The comment affects all of the SQL code in the line.

Note: This process does not try to merge a new comment with an existing comment. For example, if you comment out line 4 in an SQL statement, and then later comment out the complete SQL statement, line 4 will then have double comment notation (that is, two sets of double hyphens in positions 1 through 4 of the line). If you uncomment the complete SQL statement, line 4 will still be commented out.

Procedure

To comment out or uncomment SQL code in the SQL and XQuery editor:

  1. Select the SQL code that you want to comment out or uncomment.
    • For a single line, click anywhere in the line of code.
    • For multiple lines, drag the pointer through the lines of code.
  2. Right-click the selected SQL code, and then select Toggle Comment.

Results

The results of this process depend on the original state of the selected SQL code:

Feedback