Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple INSERT INTO 1

Status
Not open for further replies.

stefanhab

Programmer
Jul 26, 2007
31
CH
Hello there,

I tried to code a simple Example but I already stopped in the beginner phase.

I created a Access-Table

CREATE TABLE Obst_alt (
ID COUNTER NOT NULL CONSTRAINT constraintName_pk PRIMARY KEY,
PROFIL_ID integer null,
FRAGE integer null,
MERKMAL integer null,
WERT char(20) null
);

and now, try to insert some data - what seems to be a quiet easy task, but it only woks out, when I use only one INSERT line. As soon as I have two, Access annotates, that there "comes one more line after the sql-statement"

Furthermore, it always tells me, that I insert a new line into the table, when I try to insert a new line. (what is quiet annoying)


INSERT INTO Obst_alt (PROFIL_ID, FRAGE, MERKMAL, WERT) VALUES (1,1,3,"Apfel")
INSERT INTO Obst_alt (PROFIL_ID, FRAGE, MERKMAL, WERT) VALUES (1,1,7,"Banane");
INSERT INTO Obst_alt (PROFIL_ID, FRAGE, MERKMAL, WERT) VALUES (1,2,1,"Ja");
INSERT INTO Obst_alt (PROFIL_ID, FRAGE, MERKMAL, WERT) VALUES (2,1,1,"Pflaume");
INSERT INTO Obst_alt (PROFIL_ID, FRAGE, MERKMAL, WERT) VALUES (2,1,4,"Birne");
INSERT INTO Obst_alt (PROFIL_ID, FRAGE, MERKMAL, WERT) VALUES (2,1,7,"Banane");
INSERT INTO Obst_alt (PROFIL_ID, FRAGE, MERKMAL, WERT) VALUES (2,2,2,"Nein");


Thanks a lot for any kind of help or annotation
Steafn
 
perhaps you could re-post this question in forum701

i think it's a problem with either ODBC or the Jet engine, it cannot take more than one SQL statement at a time

r937.com | rudy.ca
 
it cannot take more than one SQL statement at a time "

would you say that I have to run every statement by hand?
(which would be very frustrating)
 
tut mir leid, aber ja :)

alternatively, you could enter your data into a CSV file, import it into a separate table, then do INSERT/SELECT to insert into the main table

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top