Multiple Inserts with MySQL
Andy Jarrett posted this technique for insterting multiple rows (bulk insert) in one SQL statement a few months ago. It's a handy trick:
INSERT INTO x (a,b)
VALUES
('1', 'one'),
('2', 'two'),
('3', 'three')
I tried that on a couple hundred thousand rows today, and I got an error that my statement was bigger than the Max Allowed Packet size in MySQL. So keep that in mind when using. You can either change the setting, or go about it a different way.
Tweet
Related Entries
- Insert Delayed with MySQL - August 2, 2005
- Sphinx - Open Source SQL Full Text Search Engine - November 1, 2006
- Updated SQL Reserved Words Checker - March 28, 2006
- MySQL FULLTEXT Indexing and Searching - September 29, 2005
- SQL to Select a random row from a database table - September 14, 2005
Trackbacks
Comments
using inner join... its helps vour u
RE:
On 06/10/2005 at 5:57:42 PM MDT Mr K wrote: 1 This is all good and well if you are inserting the exact same information into multiple tables, but what if you want to insert into 2 or more tables the information from ONE form, but each table has different sets of information. You have to then do it as 2 or more seperate INSERTS :(
also I want a progress that it will show how much record inserted. like 2 record inserted the 3,4,5 and so on. is it possible
Thanks in advance.
Post a Comment
Recent Entries
- Writing Secure CFML cfObjective 2013 Slides
- Upgrading to Java 7 on Linux
- J2EE Sessions in CF10 Uses Secure Cookies
- Learn about ColdFusion Security at cfObjective 2013
- Session Loss and Session Fixation in ColdFusion
- FuseGuard 2.3 Released
- CKEditor Spell Checker Plugin
- Adobe Says Go Ahead and Upgrade your ColdFusion JVM


add to del.icio.us


