Help needed for COLUMN option in SCRIPT

60 views
Skip to first unread message

Sudeep C

unread,
Sep 26, 2022, 11:12:18 AM9/26/22
to H2 Database
How can I use COLUMN option in SCRIPT.
I'm not able to figure this

java -classpath h2-1.4.199.jar org.h2.tools.Script -url "jdbc:h2:file:C:\test_db" -user sa -password "" -script "backup.sql" -options COLUMNS

Exception in thread "main" org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "SCRIPT  TO 'backup.sql'  COLUMNS[*]"; SQL statement:
SCRIPT  TO 'backup.sql'  COLUMNS [42000-199]

Please help me on this topic

Evgenij Ryazanov

unread,
Sep 26, 2022, 11:35:29 AM9/26/22
to H2 Database
Hello!

Unfortunately, this tool doesn't support all clauses of the SCRIPT command. You need to use the Shell tool or H2 Console or JDBC connection to the database.

Valid SQL command will be SCRIPT COLUMNS TO 'backup.sql'

Sudeep C

unread,
Sep 26, 2022, 11:49:14 AM9/26/22
to H2 Database
Is there any other option to retrieve the INSERT statement with column names using the above tool?
Reply all
Reply to author
Forward
0 new messages