Append Query | Multiple Tables

T

Tom

Is there a way to use an APPEND query which allows to append/insert fields
(originating from same source table) into different tables?

CHANGE FROM...
==============
INSERT INTO tblNewTable1 ( Field_1 ) SELECT tblOldTable.Field_1 FROM
tblOldTable;

TO...
=====
INSERT INTO tblNewTable1 ( Field_1 ), tblNewTable2 ( Field_2 ) SELECT
tblOldTable.Field_1, tblOldTable.Field_2 FROM tblOldTable;


The line above throws a syntax error. Any idea how to fix that?


Thanks,
Tom
 
C

Chris2

Tom,

The short answer is: no.

The long answer is: JET SQL does not allow multiple tables to be named on
the INTO clause of an INSERT statement.


Sincerely,

Chris O.

Tom said:
Is there a way to use an APPEND query which allows to append/insert fields
(originating from same source table) into different tables?

CHANGE FROM...
==============
INSERT INTO tblNewTable1 ( Field_1 ) SELECT tblOldTable.Field_1 FROM
tblOldTable;

TO...
=====
INSERT INTO tblNewTable1 ( Field_1 ), tblNewTable2 ( Field_2 ) SELECT
tblOldTable.Field_1, tblOldTable.Field_2 FROM tblOldTable;


The line above throws a syntax error. Any idea how to fix that?

Yes. Name only one table at a time on the INTO clause.

Thanks,
Tom

A short excerpt from JETSQL40.CHM, from the INSERT INTO syntax:

Multiple-record append query:



INSERT INTO target [(field1[, field2[, ...]])] [IN externaldatabase]
SELECT [source.]field1[, field2[, ...]
FROM tableexpression





Single-record append query:



INSERT INTO target [(field1[, field2[, ...]])]
VALUES (value1[, value2[, ...])





target = The name of the table or query to append records to.









Further reading of the entry on INSERT INTO does not indicate otherwise.





Sincerely,



Chris O.
 
T

Tom

Thanks for the info, Chris.

--
Thanks,
Tom


Chris2 said:
Tom,

The short answer is: no.

The long answer is: JET SQL does not allow multiple tables to be named on
the INTO clause of an INSERT statement.


Sincerely,

Chris O.

Tom said:
Is there a way to use an APPEND query which allows to append/insert fields
(originating from same source table) into different tables?

CHANGE FROM...
==============
INSERT INTO tblNewTable1 ( Field_1 ) SELECT tblOldTable.Field_1 FROM
tblOldTable;

TO...
=====
INSERT INTO tblNewTable1 ( Field_1 ), tblNewTable2 ( Field_2 ) SELECT
tblOldTable.Field_1, tblOldTable.Field_2 FROM tblOldTable;


The line above throws a syntax error. Any idea how to fix that?

Yes. Name only one table at a time on the INTO clause.

Thanks,
Tom

A short excerpt from JETSQL40.CHM, from the INSERT INTO syntax:

Multiple-record append query:



INSERT INTO target [(field1[, field2[, ...]])] [IN externaldatabase]
SELECT [source.]field1[, field2[, ...]
FROM tableexpression





Single-record append query:



INSERT INTO target [(field1[, field2[, ...]])]
VALUES (value1[, value2[, ...])





target = The name of the table or query to append records to.









Further reading of the entry on INSERT INTO does not indicate otherwise.





Sincerely,



Chris O.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top