I have a stand alone H2 server up and running gathering data. For testing I want to get data out my server into a CSV file. Are there any tools for that?
Asked
Active
Viewed 4.8k times
30
-
1Did you check: http://www.h2database.com/html/links.html#tools – Jun 20 '13 at 16:29
-
2H2 has a function to write CSV files. Check [CSVWRITE](http://www.h2database.com/html/functions.html#csvwrite). – jschiavon Jun 21 '13 at 13:31
3 Answers
86
Try CSVWRITE
This is perhaps all that you need:
call CSVWRITE ( 'C:/MyFolder/MyCSV.txt', 'SELECT * FROM MYTABLE' )
You need to just run the call (mentioned above) in the browser based client of H2 that you are most likely using.
Further reading: http://www.h2database.com/html/functions.html#csvwrite.

StackzOfZtuff
- 2,534
- 1
- 28
- 25

partha
- 2,286
- 5
- 27
- 37
-
Probably because the H2 Help command doesn't have any function resembling the term 'export'. I guess you just have to know to look for 'CSV'. See also http://www.h2database.com/html/commands.html#script – MAbraham1 Jun 22 '20 at 15:55
9
For small data, you can also use script
to export any table:
script table <table_name>

AnonGeek
- 7,408
- 11
- 39
- 55
3
Another way works for me:
script SIMPLE to 'C:\FolderName\FileName.sql' table SCHEMA.TABLENAME;

xplorerdev
- 365
- 1
- 3
- 13