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:   
Related Topics:
Multiple Inserts across multiple tables - Hi Guys, After a bit of advice really. We have a number of tables in our database, that when a new account is created it should insert into all of them (different information) get the insert ids from all and the update the first table with all the ids....

MySQL freezes, brings XP machine to a grinding halt - I've been using MySQL for a while for fairly light database development on my XP machine. Currently, I am just starting a new project and have experienced some big problems with MySQL today both on my office machine and at home where running a particular...

login as user 'root' but do not have root privlages and my.. - Hi gang: I'm experiencing a problem with MySQL -- I updated MySQL from version 4.1.0 to 4.1.10 and now when I login as root it doesn't show all the databases I should have access to, nor it doesn't recognize me being logged in as root (via..

FLUSH TABLES hangs if table is locked - Using FLUSH TABLES via the C query API mysql_query() hangs if the table is locked already. That is to say, nothing prevents me from running a LOCK TABLES twice; it won't tell me "it's already locked, don't try to run a FLUSH". Anyone know ...

Tool to convert DDL in graphical diagram? - Does anyone know of a tool that will create a graphical diagram from a DDL (SQL create script)? Preferable a free open-source tool. Thanks, A
   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 ]