On Mon, 23 Jun 2014 07:25:02 -0700 (PDT), Peter wrote:
> Hi Sandro,
>
> Thanks for your answer.
>
> I have been checked VirtualText. I see if i use VirtualText to load a
> .csv, Empty strings become NULL like i want.
>
> CREATE VIRTUAL TABLE TEST USING
> VIRTUALTEXT(FILE.CSV,'1',COMMA,DOUBLEQUOTE,';')
>
> However when i try to insert this virtual table in my table, i don't
> get because ROWID is created with VirtualText, so VirtualTable has
> one
> more column that my table.
>
> Can i solve this problem with rowid? Thanks a lot Sandro!
>
Hi Peter,
just creating a VirtualTable isn't really an "import" operation.
all data will still continue to be stored on the external file,
and the VirtualText driver will simply translate the content of
this file as if it was a standard SQL table.
so refining / completing your data import shouldn't be difficult
at all:
a) create your destination table, by specifying an eventual
Primary Key and so on.
b) copy all data from the VirtualText table into the destination
table: you simply have to execute a statement like this:
INSERT INTO zzzzz (fld1, fld2, ..... fldN)
SELECT col1, col2, ... colN
FROM virt_zzzzz;
please note: rearranging column names, ignoring useless
columns and alike would be a really simple task during
this step.
c) and finally you can drop the now useless VirtualText table;
all done.
bye sandro