My SQL Tips: How to add multiple value in multiple row at one query run?Mass Insert or Batch Insert


Mass Insert in My SQL

Hi All,

Today, one situation came where I have to use insert multiple times.I don't script want to waste time or
delay in processing. I searched and found very simple solution for this issue.
Lets say you have 30 records to insert, now inspite of calling insert query 30 times you can do something like this:

INSERT INTO tableName
    (column1,column2,column3,column4)
VALUES
    ('value1' , 'value2', 'value3','value4'),
    ('value1' , 'value2', 'value3','value4'),
    ('value1' , 'value2', 'value3','value4');
I showed here 3 times but this can be anything.
Not sure if there is any limitation but this is good way of doing Mass Insert 
or say batch insert.
 
Please share your thoughts on this , I hope this will help some one.
 
Thanks
Abhi 

Comments