首页 > 代码库 > SQL:bat批处理多个.sql文件
SQL:bat批处理多个.sql文件
一、批处理文件 update.bat
设置sqlserver的实例
记得一定要配置logfile文件
@echo off:: #### B.01 database schema update for B.01 -> B.02 -> B.03 ####set LOGFILE="D:\Forklift\B01_B02toB03_Schema_Update.log":: Tell user that the installation process is starting.echo This script will upgrade the database schema from B.01 and or B.02 to B.03. Would you like to proceed with this update?CHOICE /C YNIF ERRORLEVEL 2 GOTO EOFecho Installing the database updates ...sqlcmd /S .\SQL2008 /Usa /PHola2008! /dmaster -i "Scripts/EnzoModifications.sql" >> %LOGFILE% 2>&1if /I %ERRORLEVEL% EQU 1 ( echo [%DATE% %TIME%] Error running "EnzoModifications.sql" >> %LOGFILE% 2>&1 goto :FAILURE )echo [%TIME%] "EnzoModifications.sql" was successfully applied. >> %LOGFILE%echo [%TIME%] "EnzoModifications.sql" was successfully applied ...sqlcmd /S .\SQL2008 /Usa /PHola2008! /dmaster -i "Scripts/SxDel_SxReIndex.sql" >> %LOGFILE% 2>&1if /I %ERRORLEVEL% EQU 1 ( echo [%DATE% %TIME%] Error running "SxDel_SxReIndex.sql" >> %LOGFILE% 2>&1 goto :FAILURE )echo [%TIME%] "SxDel_SxReIndex.sql" was successfully applied. >> %LOGFILE%echo [%TIME%] "SxDel_SxReIndex.sql" was successfully applied ...
二、将.sql 文件放置在同目录的Script文件夹下
DEMO下载地址:
http://files.cnblogs.com/gguozhenqian/SQLBat.zip
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。