Kim Kohen <[EMAIL PROTECTED]> wrote:
>
> I'm trying to run a connection and query from one line (it will eventually
> be called as part of a 'do shell script' Applescript on Mac OSX)
>
> The connection works fine:
> /library/mysql/bin/mysql -uroot -ppassword mydatabase
>
> And then I want to load a file using:
> load data infile '/Users/Shared/netexp2.txt' into table classifieds fields
> terminated by ',' enclosed by '\"' lines terminated by '/r/n'
> (site,ad_number,publication,run_date,short_class,long_class, short_group,
> long_group,sort_order,ad_copy);
>
> The load statement works fine by itself (run from the mysql> prompt) but I
> don't know how to concatenate it to the connection so it can be run from one
> line. If I simply run the two statement separated by a space I get 'Badly
> placed ()'s.'
>
> Is this possible, or is there another approach I should consider?
You can use mysql in a batch mode like:
mysql .... -e "LOAD_DATA_command_here"
http://www.mysql.com/doc/en/Batch_mode.html
Take a look at the mysqlimport program. It's a command-line interface for LOAD DATA
INFILE statement:
http://www.mysql.com/doc/en/mysqlimport.html
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Victoria Reznichenko
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]