Hi,

> is it possible to append the query results to a csv file that already
> exists?

Not directly. To do that, you would need to create an Java function
alias (warning: I didn't test it):

create alias csv_append as $$
import org.h2.tools.*;
import java.sql.*;
import java.io.*;
@CODE
int csvAppend(Connection conn, String fileName, String query) throws Exception {
    ResultSet rs = null;
    FileWriter writer = null;
    try {
        rs = conn.createStatement().executeQuery(query);
        writer = new FileWriter(fileName, true);
        return Csv.getInstance().write(writer, rs);
    } finally {
        if (rs != null) rs.close();
        if (writer != null) writer.close();
    }
}
$$

Regards,
Thomas

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to