On Sat, 20 Sep 2008 10:58:25 -0400, Qianqian wrote:

> hi
>
> I am quite new to sqlite, so, please forgive me if there
> is anything obviously incorrect.
>
> I created a table with the following fields:
>
>create table final(idx varchar(10), enc varchar(8), data varchar(4096));
>
>and I want to import the following xml-type of data to this table:
>
><idx>rec1<idx>
><enc>001<enc>
><data>
>line 1
>line 2
>line 3
><data>
>
> I noticed that load_file() function does not work in sqlite,
> but sqlite has .import command.
> So, I reformatted the xml into the following
>
>rec1|001|line1
>line2
>line3
>
> and import it using the following command
>
>.separator "|"
>.import recdata.txt final
>
> sqlite complained about "recdata.txt line 2: 
> expected 3 columns of data but found 1"

The .import command is very basic and doesn't support this.

> my question is: is there a way I can import fields with
> multiple lines to sqlite? 

You will have to transform the XML into an INSERT statement,
like this:

INSERT INTO final (idx,enc,data) VALUES ('rec1','001','line1
line2
line3');

>is importing xml supported in sqlite 
>(I did not see it from the documentation)?

No, it isn't. Perhaps Tcl can do it, or xgawk.

> thank you
>
> Qianqian
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to