2h2h2h
2h2h2h

Reputation: 31

How can I insert multi rows

I try to write the SQL code to enter the 1st 2 rows of data, based on the table shown below. My code:

INSERT INTO EMP_1 ( 
    EMP_NUM, EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_HIREDATE, JOB_CODE 
)
VALUES (
    101, 'News', 'John', 'G', '08-Nov-00', '502'
);

INSERT INTO EMP_1 ( 
    EMP_NUM, EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_HIREDATE, JOB_CODE 
)
VALUES (
    102,'Senior', 'David', 'H', '12-Jul-89', '501'
);

But I keep get character error. I am using ms access 2007, ERROR" Charracter Found after end of SQL statement".

Upvotes: 1

Views: 108

Answers (2)

Nagaraj S
Nagaraj S

Reputation: 13474

Try this,You can insert multiple rows like this

INSERT INTO EMP_1 
 ( EMP_NUM, EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_HIREDATE, JOB_CODE)
VALUES (
    101, 'News', 'John', 'G', '08-Nov-00', '502'
),
(
    102,'Senior', 'David', 'H', '12-Jul-89', '501'
);

Upvotes: 0

jondinham
jondinham

Reputation: 8511

Possibly you're using the SQL execution method which is processing only a single SQL command. You can combine the SQL and use just 1 'insert' command:

INSERT INTO EMP_1 ( 
    EMP_NUM, EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_HIREDATE, JOB_CODE 
)
VALUES (
    101, 'News', 'John', 'G', '08-Nov-00', '502'
),
(
    102,'Senior', 'David', 'H', '12-Jul-89', '501'
);

Error 'Charracter found after end of SQL statement' is described here: http://office.microsoft.com/en-us/access-help/HV080760224.aspx

Upvotes: 1

Related Questions