Re: [sqlite] INSERT INTO with SELECT

2012-04-05 Thread Pete
ion of SQLite Database > Subject: Re: [sqlite] INSERT INTO with SELECT > Message-ID: > Content-Type: text/plain; charset=us-ascii > > > On 5 Apr 2012, at 1:36am, Pete wrote: > > > Here's my test: > > > > CREATE TABLE t2 (Col1 text,Col2 text); >

Re: [sqlite] INSERT INTO with SELECT

2012-04-05 Thread Igor Tandetnik
On 4/5/2012 1:09 PM, Simon Slavin wrote: On 5 Apr 2012, at 6:05pm, Simon Slavin wrote: I don't understand what you think is wrong with insert into t3 SELECT Col1 FROM t2; Oh, now I do. Okay, SQLite insists on the number of columns matching when you use a sub-SELECT So you could just do

Re: [sqlite] INSERT INTO with SELECT

2012-04-05 Thread Simon Slavin
On 5 Apr 2012, at 6:05pm, Simon Slavin wrote: > I don't understand what you think is wrong with > > insert into t3 SELECT Col1 FROM t2; Oh, now I do. Okay, SQLite insists on the number of columns matching when you use a sub-SELECT even though it doesn't when you use the bracketed form where

Re: [sqlite] INSERT INTO with SELECT

2012-04-05 Thread Simon Slavin
On 5 Apr 2012, at 5:33pm, Pete wrote: > Thank you Igor and Simon, I think I understand this now. On reading the > docs more closely, it looks like the scond test case (NOT NULL with a > DEFAULT) could be solved by using INSERT OR REPLACE. I'm wondering if > there might be a way to solve the fi

Re: [sqlite] INSERT INTO with SELECT

2012-04-05 Thread Igor Tandetnik
On 4/5/2012 12:33 PM, Pete wrote: Thank you Igor and Simon, I think I understand this now. On reading the docs more closely, it looks like the scond test case (NOT NULL with a DEFAULT) could be solved by using INSERT OR REPLACE. I don't see how. I'm wondering if there might be a way to solve

Re: [sqlite] INSERT INTO with SELECT

2012-04-05 Thread Pete
n Thu, Apr 5, 2012 at 9:00 AM, wrote: > Message: 10 > Date: Thu, 5 Apr 2012 01:38:57 +0100 > From: Simon Slavin > To: General Discussion of SQLite Database > Subject: Re: [sqlite] INSERT INTO with SELECT > Message-ID: > Content-Type: text/plain; charset=us-ascii > >

Re: [sqlite] INSERT INTO with SELECT

2012-04-04 Thread Simon Slavin
On 5 Apr 2012, at 1:36am, Pete wrote: > Here's my test: > > CREATE TABLE t2 (Col1 text,Col2 text); > insert into t2 (Col1) values('xxx'); > select * from t2 > xxx| > > CREATE TABLE t3 (Col1 text,Col2 text default 'abc'); > insert into t3 SELECT * FROM t2; > select * from t3; > xxx| > > Why do

[sqlite] INSERT INTO with SELECT

2012-04-04 Thread Pete
I'm seeing something that doesn't look right when using the SELECT form of the INSERT statement. Here's my test: CREATE TABLE t2 (Col1 text,Col2 text); insert into t2 (Col1) values('xxx'); select * from t2 xxx| CREATE TABLE t3 (Col1 text,Col2 text default 'abc'); insert into t3 SELECT * FROM t2;

Re: [sqlite] Insert into with select not working

2009-04-09 Thread Martin.Engelschalk
Hello Brian, you do not need a VALUE keyword in this case. INSERT INTO "subscribers_new" --VALUES <- remove this SELECT id, ip_address, added, 'aa:bb:cc:etc' from subscribers; See the syntax diagram for the insert command: http://www.sqlite.org/lang_insert.html Martin Brian Zambrano

[sqlite] Insert into with select not working

2009-04-09 Thread Brian Zambrano
Can anyone explain to me why an insert with select statement isn't working? I know in my my example below I just have an extra column which I could have added, but my actual tables are a bit more complex and this below is just to demonstrate the problem. -- Original table CREATE TABLE "subscribers

Re: [sqlite] INSERT INTO with SELECT

2006-11-16 Thread Jay Sprenkle
On 11/16/06, RB Smissaert <[EMAIL PROTECTED]> wrote: My text file is only an intermediate and I can make the way I want. I need to move data from Interbase to SQLite. Fastest method sofar is: IB > ADO recordset ADO recordset > text file Import text file with SQLite .import command Problem with .

RE: [sqlite] INSERT INTO with SELECT

2006-11-15 Thread RB Smissaert
uotes. RBS -Original Message- From: Jay Sprenkle [mailto:[EMAIL PROTECTED] Sent: 16 November 2006 04:24 To: sqlite-users@sqlite.org Subject: Re: [sqlite] INSERT INTO with SELECT You should create your database and your table first. Do that in sqlite3.exe using your create table statement

Re: [sqlite] INSERT INTO with SELECT

2006-11-15 Thread Jay Sprenkle
You should create your database and your table first. Do that in sqlite3.exe using your create table statement below. What format is your text file in? What separates one field from another? On 11/14/06, RB Smissaert <[EMAIL PROTECTED]> wrote: Thanks and in fact I had a look at your text import

RE: [sqlite] INSERT INTO with SELECT

2006-11-14 Thread RB Smissaert
aking the .db file and the table nil happened, so no data moved. RBS -Original Message- From: Jay Sprenkle [mailto:[EMAIL PROTECTED] Sent: 14 November 2006 14:06 To: sqlite-users@sqlite.org Subject: Re: [sqlite] INSERT INTO with SELECT On 11/13/06, RB Smissaert <[EMAIL PROTECTED]>

Re: [sqlite] INSERT INTO with SELECT

2006-11-14 Thread Jay Sprenkle
On 11/13/06, RB Smissaert <[EMAIL PROTECTED]> wrote: OK, thanks for the reply. I am using the same construction to write directly from Interbase to Access and that works fine. I'm surprised. Learn something every day! I can make an ADO recordset first from the Interbase data and write that to

RE: [sqlite] INSERT INTO with SELECT

2006-11-13 Thread RB Smissaert
PROTECTED] Sent: 14 November 2006 03:24 To: sqlite-users@sqlite.org Subject: Re: [sqlite] INSERT INTO with SELECT On 11/13/06, RB Smissaert <[EMAIL PROTECTED]> wrote: > Trying to move data from Interbase to SQLite via the ODBC driver and ADO and > having trouble to get the right sy

Re: [sqlite] INSERT INTO with SELECT

2006-11-13 Thread Jay Sprenkle
On 11/13/06, RB Smissaert <[EMAIL PROTECTED]> wrote: Trying to move data from Interbase to SQLite via the ODBC driver and ADO and having trouble to get the right syntax for the INSERT INTO statement. This is what I have now, but it fails with the error: only one SQL statement allowed. I notice

[sqlite] INSERT INTO with SELECT

2006-11-13 Thread RB Smissaert
Trying to move data from Interbase to SQLite via the ODBC driver and ADO and having trouble to get the right syntax for the INSERT INTO statement. This is what I have now, but it fails with the error: only one SQL statement allowed. Sub InsertIntoSQLLite() Dim cn As SQLiteDb.Connection Di