One, batch file Update.bat
Set up an instance of SQL Server
Make sure to configure the logfile file
@echo off:: # # # # # B. on Database Schema Update forB. on -B. Geneva -B.Geneva ####SetLOGFILE="D:\Forklift\B01_B02toB03_Schema_Update.Log":: TellUserthat the installation process isStarting.echo This script would upgrade theDatabase Schema fromB. on and orB. Geneva toB.Geneva. Would like toProceed withThisUpdate? CHOICE/C YNIFERRORLEVEL2 GOTOEofecho Installing theDatabaseupdates ... sqlcmd/S. \sql2008/Usa/phola2008!/Dmaster-I "Scripts/Enzomodifications.sql ">> %LOGFILE% 2>&1if /I%ERRORLEVEL%EQU1(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%EQU1(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 ...
Ii. Place the. sql file under the Script folder in the same directory
DEMO:
Http://files.cnblogs.com/gguozhenqian/SQLBat.zip