I am trying to execute the following code. However, I continue to recieve the following 'Missing semicolon (;) at the end of SQL statement error in Microsoft Access.
The first query creates the table with the columns defined.
create table test
(
ProcessID int,
Name varchar(10),
Address varchar(10),
RandomData varchar(10)
);
The second query is causing the missing semicolon error.
INSERT into test
VALUES (123 , 'TestName', 'TestAdd', 'qwrj3ri'),
(456 , 'TestName2', 'TestAdd', 'qwerty'),
(789 , 'TestName', 'TestAdd', 'qwrj3ri'),
(1234, 'Testing123', 'tester', 'asdfghjk');
Code with amendments per above comments to make it Access friendly & remove typos:
INSERT INTO test ( ProcessID, Name, Address, RandomData)
VALUES (123 , 'TestName', 'TestAdd', 'qwrj3ri');
INSERT INTO test ( ProcessID, Name, Address, RandomData)
VALUES (456 , 'TestName2', 'TestAdd', 'qwerty');
INSERT INTO test ( ProcessID, Name, Address, RandomData)
VALUES (789 , 'TestName', 'TestAdd', 'qwrj3ri');
INSERT INTO test ( ProcessID, Name, Address, RandomData)
VALUES (1234, 'Testing123', 'tester', 'asdfghjk');
Useful reference: https://msdn.microsoft.com/en-us/library/bb243852(v=office.12).aspx
Specific comments:
@Damien_The_Unbeliever:
I don't think access supports multiple rows in the values.
Amended to include an insert into
per row instead of a value set per row (values (...), (...)
).
@Thomas Tschernich:
our missing single quote next to the end of your insert
Changed 'tester', sdfg')
to 'tester', 'sdfg');
@JohnLBevan:
superfluous character on end of first set of values
Changed 'qwrj3ri'), T
to 'qwrj3ri'),
You can insert multiple rows in one insert statement in SQL server,but in MS ACCESS its not possible as above listed.
More techniques on multiple inserts in access are described beautifully here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With