这是我的第一个批处理文件,我一直无法找到答案(或我可以破译的线索)。编程新手,尝试在单个批处理文件中运行多个 .sql 语句。这是我能做到的。问题是,苍蝇一次只处理一只股票,底部的 2 个 COUNTS 文件会重复自己 - 所以我需要在用户更改第一个 .sql 文件中的股票代码并让它们循环运行之后运行它们直到输入最后一个库存——然后在最后运行 COUNTS 个文件。
@echo off
cd "C:\Program Files\MySQL\MySQL Server 5.5\bin"
mysql -h -u -p -Dstock_market < "C:\mysql assignment 1\good scripts\load_csv_data_MySQL.sql"
mysql -h -u -p -Dstock_market < "C:\mysql assignment 1\good scripts\derived_DAILY.sql"
mysql -h -u -p -Dstock_market < "C:\mysql assignment 1\good scripts\derived_MONTHLY.sql"
mysql -h -u -p -Dstock_market < "C:\mysql assignment 1\good scripts\derived_DEFAULT_updates.sql"
:this is where I need to have the file either loop back through the above scripts with
:a different stock (with files above updated by the batch user who has access to the .sql files) or when
:all stocks have been entered, to continue to the 2 .sql scripts below
mysql -h -uroot -p -Dstock_market < "C:\mysql assignment 1\good scripts\INSERT_INTO_COUNTS_daily.sql"
mysql -h -uroot -p -Dstock_market < "C:\mysql assignment 1\good scripts\INSERT_INTO_COUNTS_monthly.sql"
exit
非常感谢任何帮助(请记住我完全缺乏批处理文件的经验)!PS这是一项个人作业,不适用于任何类型的学校,我现在只使用网络自学(和Murach的MySQL书)......
谢谢!