I'm manually duplicating a few records and would like to paste the INSERT statements directly into Query Browser, but I have only ever performed one INSERT at a time with QB. Is it possible to insert, and run, 400+ inserts one after another without having to manually initiate each?
Open a New Script Tab, located under File. Paste your inserts, and press Execute.
as you said, yes it's possible....but IMO if you have the 400+ insert statements, you'd be better off saving them into a plain text file and running them with the mysql command line client.
that way, you get to use your favourite editor to create the file rather than a tiny little input window in the QB. Your editor will probably also have far better editing capabilities, including syntax highlighting.
if the insert statements are all the same except for the actual data to be inserted, then you can put just the data in, say, a CSV file and write a simple perl/awk/php/whatever script to generate the SQL from that....then load that into your editor for any final edits. or you could use the LOAD DATA statement instead of individual INSERT statements.
other advantages of using a text-file sql script are:
finally, if you're using a database engine that supports transactions (e.g. innodb) then remember to use them to ensure that either ALL inserts are successfully completed, or NONE are. that allows you to safely correct and re-run the sql script if there was an error.
The old MySQL Query Browser and MySQL Administrator have been replaced by MySQL Workbench.
MySQL Workbench includes: - Model (replacing DBDesigner) - Query (replacing MySQL Query Browser) - Admin (replacing MySQL Administrator) - SSH-Tunnel (Remote Admin)
MySQL Workbench discussions:
- http://forums.mysql.com/index.php?151