Re: importing data to a table that has generated-columns

Scott Robison <scott-Ae29gXyI3ZaoShpikNbDkQC/[email protected]>
Newsgroups gmane.comp.db.sqlite.general
Message-ID <CAPbjwUCcj-QUna8nvewZhxeb1RU_bK1iNkPuN7x88woutwQBpA@mail.gmail.com>
On Sun, Jan 26, 2020 at 11:01 AM chiahui chen <[email protected]>
wrote:

> Hi,
>
> After creating a table (total 8 columns including 1 generated column) , I
> tried to import data from a csv file (each record has values for 7 columns
> that match the non-generated column names and data types, no headers ).
>
> The system issued " error:  table has 7 columns but 8 values were supplied.
> ' I wonder why.
>
> After experimenting different ways to import data to a table that has a
> generated column, so far I only found that  .read command with a .sql file
> that was output  as a result of  'mode insert'  is successful. Is there any
> other ways to import data to an existing generated-column table?
>

I would be inclined to import the csv as a temp table, then write an INSERT
INTO ... SELECT ... query to move the appropriate columns from the temp
table into the new table.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.