简单批处理执行SQL语句

该批处理脚本提供了一个交互式环境,用户可以选择TESTMPSDMI或TESTMPSPA数据库,然后依次执行一系列SQL文件(如SC120.sql到SI040.sql),并将输出日志记录到相应的.log文件中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

@ECHO OFF


cls
echo *******************************************************
echo BactFile 実行環境選択
echo *******************************************************
echo [1]:TESTMPSDMI
echo [2]:TESTMPSPA
echo *******************************************************
set /p ENT="DataBase を 選択してください。>"
setlocal
if "%ENT%"=="1" (
set dbnm=TESTMPSDMI
) else (
set dbnm=TESTMPSPA
)
echo DataBase : %dbnm%


echo .
echo 途中で終了したい場合は、「Ctrl + C」を入力してください。
PAUSE


osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SC120.sql > SC120_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SC200.sql > SC200_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SC210.sql > SC210_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SC220.sql > SC220_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SC230.sql > SC230_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SC240.sql > SC240_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SC250.sql > SC250_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SC260.sql > SC260_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SC300.sql > SC300_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SC310.sql > SC310_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SC320.sql > SC320_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SI030.sql > SI030_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\SI040.sql > SI040_Insert.log
osql -S localhost -U sa -P MPS@Admin -d %dbnm% -i .\update_sql.sql > update_sql_Update.log



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值