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?
3 Answers
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.
1 Comment
MAbraham1
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 h2database.com/html/commands.html#script
For small data, you can also use script to export any table:
script table <table_name>
1 Comment
Zaphod Beeblebrox
Nice answer, but this command produces SQL statements, not a CSV file as requested in the original question.