Code Snippet Details

<- Back to List


Language
DOS Batch File
Description
SQL Server Release Batch File
Code
rem ======================================================================================================== rem File: Training_Release.bat rem Description: Release of Training database rem Developer: Andy Creigh rem Comments: Runs the deployment batch and outputs to the log file named below. rem Command Line: myComponentsBatchFileName myServerName myDatabaseName >myLogFileName rem ======================================================================================================== Training_Deploy_Components.bat MACHINE\SERVER Training >Results\Training_Release.log @echo off if(%1)==() goto Error if (%2)==() goto Error @echo ======================================================================================================== @echo File: Training_Deploy_Components.bat @echo Description: Deployment of Training database @echo Developer: Andy Creigh @echo ======================================================================================================== @echo Sub-Scripts @echo -------------------------------------------------------------------------------------------------------- @echo -------------------------------------------------------------------------------------------------------- @echo Training components @echo -------------------------------------------------------------------------------------------------------- sqlcmd -S%1 -dMaster -i "1 Create the training database.sql " sqlcmd -S%1 -d%2 -i "2 Create Department table.sql" sqlcmd -S%1 -d%2 -i "3 Create employee table.sql" sqlcmd -S%1 -d%2 -i "4 Populate Department table.sql" sqlcmd -S%1 -d%2 -i "5 Populate Employee table.sql" sqlcmd -S%1 -d%2 -i "6 Create Employee View.sql" sqlcmd -S%1 -d%2 -i "7 Create Employee Stored Procedure.sql" @echo -------------------------------------------------------------------------------------------------------- @echo Checking logic @echo -------------------------------------------------------------------------------------------------------- sqlcmd -S%1 -d%2 -Q "SELECT * FROM Employee" -o Results\Employee.txt sqlcmd -S%1 -d%2 -Q "SELECT * FROM Department" -o Results\Department.txt @echo -------------------------------------------------------------------------------------------------------- @echo Routines @echo -------------------------------------------------------------------------------------------------------- sqlcmd -S%1 -d%2 -Q "SELECT * FROM Training.information_schema.routines order by routine_type, specific_name" -o Results\Routines.txt sqlcmd -S%1 -d%2 -Q "SELECT COUNT(*) AS Routines FROM Training.information_schema.routines" -o Results\RoutinesCount.txt goto End :Error @echo -------------------------------------------------------------------------------------------------------- @echo Error! Script should be run as: myComponentsBatchFileName myServerName myDatabaseName @echo -------------------------------------------------------------------------------------------------------- :End