Start a new topic

Process query around comments?

[This topic is migrated from our old forums. The original author name has been removed]

Let's say I have the following query SELECT Column1, Column2, Column3, Column4 FROM Table It would be nice if I could simply comment out one of the columns and still run the query. As it stands, it gives me an error. SELECT Column1, Column2, //Column3, Column4 FROM Table [Error Code: 12, SQL State: 37000] [SQLCODE: :A term expected, beginning with one of the following: identifier, constant, aggregate, $$, :, (, +, -, %ALPHAUP, %EXACT, %MVR, %SQLSTRING, %SQLUPPER, %STRING, %TRUNCATE, or %UPPER] Edited by: Scott Beeson on Jun 17, 2015 9:14 PM

[This reply is migrated from our old forums. The original author name has been removed]

Re: Process query around comments?
Apparently if you use the multiline comment syntax it works. SELECT Column1, Column2, /*Column3, */ Column4 FROM Table
[This reply is migrated from our old forums. The original author name has been removed]

Re: Process query around comments?
Oh, so does -- for a single line! I guess I was just using the wrong comment syntax :)
[This reply is migrated from our old forums. The original author name has been removed]

Re: Process query around comments?
Two forward slash characters (//) is DbVisualizer syntax for a single-line comment. If "Preprocess script" is not enabled the commented statement will be passed unchanged to your DBMS and probably fail. In my experience, you're better off using the single-line comment syntax for your DBMS (eg. two hyphen/dash characters (--) in practically all of the DBMS products I've worked with) which should work regardless of the status of the "Preprocess script" flag.