Previous Topic

Next Topic

Book Contents

Book Index

Including comments in your SQL

You can include comments in your SQL. These are generally used when you are running an SQL script, or including as part of a Stored Procedure, Trigger or Function Definition.

There are several ways for specifying comments:

For many databases, comments are not valid statements. It is expected that the script-processor (in this case AQT) will remove the comments from the SQL before passing it to the database for processing. Consequently, when running some SQL, AQT will:

Remove Comments option

In some circumstances you may want the line comments to remain in your SQL. For instance, you are defining a Stored Procedure and want the comments to remain as part of the procedure definition.

In this case, go to Options > Run SQL and de-select Remove Comments from SQL. When this option is de-selected, AQT will retain all the line comments that appear within the body of your SQL statement. Any line comments appearing before the start of your SQL statement will be removed unless Retain comments before start of SQL is selected.

This option only affects the processing of line comments. Other comments are handled as described earlier.

Beware - if you de-selected this option and include line-comments within normal SQL (such as queries, updates, inserts etc), you may get a syntax error with some databases.

Advanced Query Tool
https://www.querytool.com
© 2023 Cardett Associates Ltd. All rights reserved.