Monday, August 30, 2010

@echo off

@echo Please wait while the process executes ....

SET USER=sa
SET PASSWD=Passwor
SET DB_SERVER=Jegan
SET DB_NAME=Mas_DB

SET ERR_LOG=LoadDatabase.log
SET TEMP_ERR_LOG=tmpError.log

DATE /T >> %ERR_LOG%
TIME /T >> %ERR_LOG%
cd Scripts

sqlcmd -S %DB_SERVER% -U %USER% -P %PASSWD% -i Killprocesses.sql >> %ERR_LOG%
sqlcmd -S %DB_SERVER% -U %USER% -P %PASSWD% -i DBDrop.sql >> %ERR_LOG%
sqlcmd -S %DB_SERVER% -U %USER% -P %PASSWD% -i RestoreDB.sql >> %ERR_LOG%

cd ..

@echo Running file in Database for Tables >> %ERR_LOG%
cd Tables
::For %%i in (bd_disclaimer.sql) do call :executeFile "%%i"
cd ..


@echo Running file in Database for Metadata >> %ERR_LOG%
cd Metadata
::For %%i in (.sql) do call :executeFile "%%i"
cd..


@echo Running file in Database for Procedures >> %ERR_LOG%
cd Procedures

::Reports
For %%i in (usp_SP1.sql) do call :executeFile "%%i"
For %%i in (usp_SP2.sql) do call :executeFile "%%i"


::Master Package
For %%i in (Usp_SP3.sql) do call :executeFile "%%i"



cd ..





@echo Process Completed >> %ERR_LOG%
DATE /T >> %ERR_LOG%
TIME /T >> %ERR_LOG%
@echo Process completed . Please refer %ERR_LOG% for any possible errors.
pause

goto :eof

:executeFile

@echo Processing %1 file >> ..\%ERR_LOG%

IF DEFINED USER (
IF "%USER%" EQU "$DBLoginUser$" (
sqlcmd -S %DB_SERVER% -d %DB_NAME% -E -i %1 -o %TEMP_ERR_LOG%

) ELSE (

sqlcmd -S %DB_SERVER% -d %DB_NAME% -U %USER% -P %PASSWD% -i %1 -o %TEMP_ERR_LOG%
)
) ELSE (
sqlcmd -S %DB_SERVER% -d %DB_NAME% -E -i %1 -o %TEMP_ERR_LOG%


)

TYPE %TEMP_ERR_LOG% >> ..\%ERR_LOG%
DEL %TEMP_ERR_LOG%
goto :eof

:eof

1 comment:

Anonymous said...

top [url=http://www.001casino.com/]casino[/url] hinder the latest [url=http://www.casinolasvegass.com/]free casino[/url] autonomous no set aside bonus at the chief [url=http://www.baywatchcasino.com/]casino bonus
[/url].