INSERT INTO (multiple values)

A

Adam Clauss

I want to create an INSERT INTO query that inserts multiple records - but NOT from another table. I simply want to build the values
straight into the query. In MySQL it would be done as:
INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)

Can this not be done with Access?
 
R

rich

Without writing a loop in VBA you cant.

Basically you have to do and INSERT INTO using a FROM clause (ie, from
another table)

Rich
 
A

Adam Clauss

Dang... well if the records were already in another table, that would defeat the purpose :) I'm parsing the entires in from a file.
I would rather add the entire file in at once rather than via individual INSERTS for performance purposes. Each file contains ~ 50
records, and there are about 500 files.
 
J

Judy Rudek

Adam Clauss said:
I want to create an INSERT INTO query that inserts multiple records - but NOT from another table. I simply want to build the values
straight into the query. In MySQL it would be done as:
INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)

Can this not be done with Access?

I don't think so. You can do it with multiple INSERT statements
though, although that could be a little cumbersom.

Sorry I can't be of more help. Perhaps someone else here will have a
better solution.

-- Judy
 
R

rich

how about writing a routine to import the files into a temp table, then
UPDATE? Are the files text files?

Rich
 
P

Pieter Wijnen

You Can't have multiple VALUES statements but u can do it like this:

INSERT INTO table (a,b,c) VALUES (1,2,3)

INSERT INTO table (a,b,c) VALUES(4,5,6)
 

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