Welcome to dbFreaks.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Best way to issue hundreds of inserts/updates???

 
   Database Help (Home) -> mySQL RSS
Next:  Using NonUnique Index to Enforce Uniqueness  
Author Message
Craig Stadler

External


Since: Nov 17, 2003
Posts: 2



(Msg. 1) Posted: Wed Feb 23, 2005 4:40 am
Post subject: Best way to issue hundreds of inserts/updates???
Archived from groups: mailing>database>mysql, others (more info?)

Using mysql 4.0.23-

What is the best way to execute several (hundreds of) inserts and updates?
Rather than issuing tons of individual inserts and updates, can I send the
strings to a text file and then have mysql do them all??

IE :
query.txt

insert into table1 (col1,col2) values (1,2);
insert into table1 (col1,col2) values (9,4);
update table1 set col2=0 where col1=9;
insert into table1 (col1,col2) values (5,2);
insert into table1 (col1,col2) values (6,2);
insert into table1 (col1,col2) values (4,2);

Whats the best/fastest way to execute a few hundred of these?
Should I lock the table and then somehow use mysql.exe to run all the
commands in the txt file??

Any help appreciated...syntax also appreciated Smile
Craig

 >> Stay informed about: Best way to issue hundreds of inserts/updates??? 
Back to top
Login to vote
Display posts from previous:   
   Database Help (Home) -> mySQL All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]