简体   繁体   English

将 H2 数据库中的数据导出为 CSV

[英]Export data from H2 database into CSV

I have a stand alone H2 server up and running gathering data.我有一个独立的 H2 服务器启动并运行收集数据。 For testing I want to get data out my server into a CSV file.为了进行测试,我想将服务器中的数据导出到 CSV 文件中。 Are there any tools for that?有什么工具可以做到这一点吗?

Try CSVWRITE尝试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.您只需要在您最有可能使用的基于浏览器的 H2 客户端中运行调用(如上所述)。

Further reading: http://www.h2database.com/html/functions.html#csvwrite .进一步阅读: http : //www.h2database.com/html/functions.html#csvwrite

对于小数据,还可以使用script导出任意表:

script table <table_name>

另一种方法对我有用:

script SIMPLE to 'C:\FolderName\FileName.sql' table SCHEMA.TABLENAME;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM