Anil
Anil

Reputation: 1488

How to comment in hsqldb script file

I want to comment a query in .script file, how do I do this? I tested with #,--,({}),<--! -->,:: nothing worked. I get ad exception about unexpected token.

Upvotes: 3

Views: 4506

Answers (3)

fredt
fredt

Reputation: 24352

HSQLDB stores the structure of the database in a file named dbname.script as a set of SQL statements. Normally, this file is not edited by the user. You cannot add comments to this file.

You can add comments on tables and columns with the SQL statement below:

COMMENT ON TABLE schemanme.tablename IS 'this is the user comment'

See the Guide: http://hsqldb.org/doc/2.0/guide/databaseobjects-chapt.html#dbc_commenting

Upvotes: 2

Rob
Rob

Reputation: 51

I was also having a problem with SQL stye comments in spring embedded database scripts. But it looked like it was because the beginning of each statement to the end of each statement was being processed as a single line thus any -- in the statement caused the rest of that statement, instead of just the rest of the line, to be commented out. So I trying switching to /* ... */ style comments and now life is much betters.

Upvotes: 5

John Kroubalkian
John Kroubalkian

Reputation: 291

If you look HERE it says:

SQL Comments

-- SQL style line comment // Java style line comment /* C style line comment */ All these types of comments are ignored by the database.

But, in practice, at least when running from a spring embedded database script, these seem problematic.

Upvotes: 2

Related Questions