Jump to content

Insert multiple rows into database

Recommended Posts


I am using  NI_Database_API.lvlib on Labview 2017. I am tringot insrt multiple rows into table but I have the error : 'Semicolon seperatot is missing at the end of the query.'

Plaese find below my command to insert two rows onto one table T_Column ( C_Name as String, C_Status as String).

INSERT INTO T_Column (C_Name , C_Status)
VALUES('21' , 'Not realised'),
('22' , 'Not realised');

How do I must modify the query? Is it possible to insert multiple rows using Microsoft.oledb.4.0?

Thanks for your help.

Link to comment

Depends on the database. For example, oracle does not support multiple inserts in a single query like that. Instead you'd have to use:

INSERT INTO T_Column (C_Name , C_Status) VALUES('21' , 'Not realised');
INSERT INTO T_Column (C_Name , C_Status) VALUES('22' , 'Not realised');

On the one hand this sucks, but on the other hand if you're using oracle this is probably the least of your worries. :(


On a related note, it looks like you are manually generating sql queries. While fine for development, its generally recommended to use parameterized statements to help avoid sql injection attacks.

Link to comment
  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.