PREPAREDSTATMENT - SCRIPT COLUMNS HELP

45 views
Skip to first unread message

Bruno Santos Silva

unread,
Aug 8, 2019, 4:10:42 PM8/8/19
to H2 Database

Good afternoon, I'm using the latest version of h2 1.4.199 and would like to know if the command:

PreparedStatement statement = conn.prepareStatement
("SCRIPT COLUMNS TO?"); It works?

I only need a script with all my database inserts.

I tried passing the names of the tables I try to export unsuccessfully.


I was able to run the following commands already:

 PreparedStatement statement = conn.prepareStatement
("SCRIPT SIMPLE TO?");

PreparedStatement statement = conn.prepareStatement
("SCRIPT DROP TO?");

PreparedStatement preparedStatement = conn.prepareStatement
("DROP ALL OBJECTS;");

PreparedStatement statement = conn.prepareStatement
("RUNSCRIPT FROM?")

PreparedStatement statement = conn.prepareStatement
("SCRIPT NODATA?")

If you know more can you send me?

Evgenij Ryazanov

unread,
Aug 8, 2019, 9:54:48 PM8/8/19
to H2 Database
You don't need a COLUMNS clause. It only changes insert statements from INSERT INTO TBL VALUES (1, 2, 3) to INSERT INTO TBL (A, B, C) VALUES (1, 2, 3), it can be useful if you want to load the script into some other database that don't support insert statements without names of columns.


I only need a script with all my database inserts.
Unfortunately, H2 doesn't export such scripts. And I don't think that such script will be suitable for your use case, that was described here: https://groups.google.com/forum/#!topic/h2-database/1j9OAZpy5NA

Sudeep C

unread,
Sep 26, 2022, 11:29:40 AM9/26/22
to H2 Database
To get insert statement like INSERT INTO TBL (A, B, C) VALUES (1, 2, 3), what command I have to use?
Reply all
Reply to author
Forward
0 new messages