create a windows 2000 batch file that executes a mysql stored procedure
I want to create a batch file that I can run from the desktop. This batch file should execute a stored procedure in MySQL.
This is what I have so far:
cd\
cd Program Files
cd mysql
cd mysql server 5.1
cd bin
mysql.exe -h host_ip -u login --password=password
mys开发者_StackOverflow中文版ql use database_name \g
mysql call sp_stored_proc_name \g
The batch file logs into the server but it doesn't execute the stored procedure.
Put your SQL commands to call the stored procedure as if you were at the command line
call sp_stored_proc;
in a .sql file (i.e. stored_proc.sql), then put the following in your batch file.
cd "\Program Files\mysql server 5.1\bin"
mysql -h host -ulogin -ppassword -Ddatabase_name < \path\to\stored_proc.sql > output.txt
精彩评论