I have some code that works well and will create a temporary table and insert records into it. It will batch them into groups of 1000 and then execute. It looks something like this.
INSERT INTO Fruit VALUES ('apple', 'orange', 'pineapple');INSERT INTO Fruit VALUES ('pear', 'mango', 'strawberries');
The values go into the first 3 columns of the table and let’s say they are named fruit_1, fruit_2, fruit_3.
Now I am trying to do something similar into a permanent table where the first 3 columns are the primary key, creation date, and modification date and I need to skip those. So I have to name the columns I’m inserting the data into.
INSERT INTO Fruit (fruit_1, fruit_2, fruit_3) VALUES ('apple', 'orange', 'pineapple');
If I string a bunch of those together into a string and properly terminate each INSERT then the only record that gets into the database is the last one no matter how many precede it.
However if I do something like this it works.
INSERT INTO Fruit (fruit_1, fruit_2, fruit_3) VALUES ('apple', 'orange', 'pineapple'),('pear', 'mango', 'strawberries');
I’m inclined to think there’s a commit issue but not sure. I’m just curious as to why it’s behaving that way. I’d be happy to hear suggestions. Thanks!