Обсуждение: how to get "autonumber" when using INSERT INTO

Поиск
Список
Период
Сортировка

how to get "autonumber" when using INSERT INTO

От
Richard Chrenko
Дата:
I'm trying what seems to me a trivial SQL task using Microsoft ADO to
write an Access table. I have several default tables containing the same
20 fields (but different data). I want to append the contents of these
tables into a "master" table which contains the same 20 fields in
addition to an autonumber field such that each appended record has a
unique identifier.

The following SQL queries succeed when run directly from Access

INSERT INTO mastertbl SELECT * FROM default1;
INSERT INTO mastertbl SELECT * FROM default2;

where mastertbl contains the same fields as default1 and default2 in
addition to an autonumber field. However, when these queries are
submitted via ADO from another application I get an error message that
the number of fields are unequal.

Please help me to get this to work using ADO!