Append Query | Multiple Tables

  • Thread starter Thread starter Tom
  • Start date Start date
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
 
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.
 
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.
 
Back
Top