You can specify the full path as an argument surrounded by single
quotes.
If you wanted to specify only the file name - it would assume it was
in the directory where you launched H2 from.
CREATE TABLE FILEDATA1 AS SELECT * FROM CSVREAD('c:\temp
\my_file.csv');
The downside of this is that it assumes everything is a huge varchar
column - so after the initial load it's a good idea to create the
table ahead of time with the proper datatypes and sizes, then do an
INSERT INTO PRECREATEDTBL SELECT field,list,here from CSVREAD('c:\temp
\my_file.csv');
Table rotation could be done with ALTER TABLE RENAME and then re-
creating the table with the original name to accept the new incoming
csv.
On Jun 8, 7:01 am, Dean <[email protected]> wrote:
> Can someone help me with loading data to a table please?
>
> I'm a new user to H2 and have seen that I can CSVread a csv file into
> a table but can do it.
> I've tried to read the help but don't know where to store the csv
> file. I've tried the csvwrite to see where H2 stored it but can find
> the output file.
>
> I'd also like to be able to "Backup" a table before adding new data
> with the csvread just incase but again it does not seem to be doing
> anything.
>
> Yes I am logged in as the Admin user.
>
> Help please?
>
> Thanks
> Dean
--
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.