SQL statement in Visual data manager

  • Thread starter Thread starter mary tate
  • Start date Start date
M

mary tate

I have a dataset with several tables in it. I want to
append all the records from one table to another, field
names are mostly the same, as least the data I want to
append from the table anyway.

I tried:

INSERT INTO
Customer
customer.*
SELECT
name as Name, address1 as Address1,city as city,
state as state, zipcode as zipcode, homepphone as
homephone, workphone as workphone, lastin as lastin,
notes as notes
FROM
jcust

Customer being the table I want to append the records
into and Jcust being the table I want to append records
from.

I get a syntax error. can you help?

Thanks
Mary
 
Hi,


INSERT INTO Customer
SELECT jcust.name, jcust.address1, jcust.city, ...
FROM jcust

or


INSERT INTO Customer
SELECT *
FROM jcust


It is generally perferable to supply both lists, in case table structure
ever change...

INSERT INTO tableGettingNewData ( list of fields to specify )
SELECT list_of_supplied_values
FROM tableSupplyingData
[WHERE something occur]


since you may want to skip fields with default values, autonumber, allowing
nulls.



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top