Questions tagged [multiple-insert]

Use this tag for questions about inserting multiple rows in a single statement into an SQL database.

Multiple row inserts are a feature of many SQL databases. They're a feature of the SQL-92 standard.

The most common syntax for multiple row inserts is similar to a normal INSERT INTO statement, but with multiple value groups separated by comma's

INSERT INTO MyTable(Value1, Value2)
VALUES 
    ('Value1Row1', 'Value2Row1'), 
    ('Value1Row2', 'Value2Row2'),
    ('Value1Row3', 'Value2Row3')

Alternatively, multiple row inserts can be achieved by using an INSERT INTO ... SELECT statement and UNION queries in many RDBMS.

For more information, see Wikipedia on multi-row inserts.

81 questions
1
vote
2 answers

Perl: Multiple inserts Oracle DB table from CSV

I am trying to insert a large number of records from a CSV file to a table in Oracle DB, in a Linux environment. The insert is simple - the CSV has IDs that need to be inserted to a single column table, for further processing. Following was my line…
Tech_Coder
  • 185
  • 1
  • 2
  • 8
1
vote
1 answer
1
vote
2 answers

How retrieve in PHP the generated PRIMARY KEY from an AUTO_INCREMENT column for each row with an INSERT of multiple rows in MySQL?

I have an INSERT with syntax for insert multiple rows: INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9); With MySQL function LAST_INSERT_ID() can retrieve the primary key of an generated AUTO_INCREMENT column, but how can I retrieve the…
Jose Nobile
  • 3,243
  • 4
  • 23
  • 30
1
vote
0 answers

SQL parameterised Insertion Union Query

I have been successful with multiple insertion with around 200 records but my problem is order in which the data is being inserted.The records are inserted in SD_0, SD_1, SD_10, SD_100, ..so on. My required order is SD_0, SD_1, SD_2, SD_3,....so…
Shail
  • 11
  • 2
0
votes
1 answer

insert multiple rows from array into table with unique ID

I have copied and modified a script off the internet. The script originally deleted selected records from a mysql table query. I have modified the script to insert the selected records into another table with the insert into statement. I would like…
Smudger
  • 10,451
  • 29
  • 104
  • 179
0
votes
0 answers

Validation multiple insert data laravel ajax

i need some help. I want to store multiple data and validation using laravel ajax, and i want to display error validation like that : In inspect elemen, error validation is displayed, but when i want displayed in bottom form input, error validation…
Franky
  • 31
  • 3
0
votes
1 answer

Inserting multiple rows from multiple question radio form in PHP

I have a form to determine the user's personality. So each question (there are 25) has 4 possible answers to choose from:
0
votes
1 answer

Inserting multiple rows in mysql php

I'm trying to insert multiple rows but I continue getting an sqlerror and cannot for the life of me figure out why. echo '"'.$thequery.'"'; $sql = mysql_query($thequery) or die(mysql_error()); return "SUCCESS"; $thequery gets printed…
y3di
  • 673
  • 2
  • 8
  • 13
0
votes
1 answer

Converting SQLite3 from MySQL database [Insert problem]

I am trying to execute a SQL file (A dump file from MySQL database) inside a SQLite3 database. The problem I am facing is that the dump file has a multiple insert that is not handled by SQLite3. Here is an example: INSERT INTO resultset_values (id,…
Joseandro Luiz
  • 8,744
  • 4
  • 20
  • 20
0
votes
1 answer

Sequelize Insert transaction (two tables, multiple rows)

Two tables: post and post_resources. The logic I want to implement: Whenever I add data to post table, I want to add resources as well to the post_resources table, with the same foreign key of PostId How I'm doing it: const post = { name:…
Mr Smiley
  • 55
  • 1
  • 6
0
votes
1 answer

Insert Row Into 2 Tables Linked w/Foregin Key Only If The Dependable Table's Insert Succeeds (Without Transaction)

I have two MySQL tables and I need to insert a record in each of them. Caveat: The insert into dependable table may fail due to duplicate key conflict. In that case none of the rows should be inserted. CREATE TABLE `meanings` ( `id` int(10)…
elixon
  • 1,123
  • 12
  • 15
0
votes
1 answer

Laravel multiple data insert into database

i want to insert more items to one delivery_notes_id in Laravel. But i get the error "Array to String conversion". When i delete the code with $lastid then is no error. Can you help me? $data=$request->all(); …
Daniela
  • 1
  • 2
0
votes
1 answer

In Oracle, how do i create stored procedure to insert value in 2 tables

I am trying to insert below details in two table. but it shows error. where i am wrong? create or replace PROCEDURE ADD_customer_order( customer_id in varchar, Shipping_id_arg in number, order_date_arg in date, Total_price_arg in…
Jade
  • 27
  • 6
0
votes
1 answer

codeigniter : Input multiple insert to database

I did multiple inserts with different qty. when making a transaction, I accommodate it in a temporary or append table. However, only the last qty is stored this HTML MODEL public function simpan_data($data_pickup){ …
Tito
  • 17
  • 6
0
votes
2 answers

How to find out if rows exist in database when inserting multiple rows by one submit

A newbie is asking help here. I’ve created a multiple inserting form, where’s 3 fields. Let’s say that fields’ name are: “name”, “surname” and “age”. I’m trying to insert them into database in the case if there’s not already same data in database.…