Gael Anquetil Posted June 25, 2019 Report Share Posted June 25, 2019 Hello, 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. Quote Link to comment
smithd Posted June 26, 2019 Report Share Posted June 26, 2019 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. Quote Link to comment
Phillip Brooks Posted July 1, 2019 Report Share Posted July 1, 2019 On 6/25/2019 at 11:04 PM, smithd said: 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. Obligatory Bobby Tables reference 1 1 Quote Link to comment
Gael Anquetil Posted November 5, 2019 Author Report Share Posted November 5, 2019 Does anybody found a solution to execute multiple insert query?? Because now I need to insert like 250000 rows and it takes a journey to do this... I think there is a parameter I need to modify in the connector or seems like that to allow multiple queries. Thank you for your help...it's quite urgent... Quote Link to comment
jcarmody Posted November 5, 2019 Report Share Posted November 5, 2019 I've done it using a parameterized query: Quote Link to comment
JKSH Posted November 6, 2019 Report Share Posted November 6, 2019 9 hours ago, jcarmody said: I've done it using a parameterized query Wrapping the queries in a transaction ("BEGIN TRANSACTION" + "END TRANSACTION") could speed things up a lot for 250000 rows Quote Link to comment
smithd Posted November 6, 2019 Report Share Posted November 6, 2019 https://stackoverflow.com/questions/39576/best-way-to-do-multi-row-insert-in-oracle Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.