Skip to content

Instantly share code, notes, and snippets.

@PJensen
Created March 10, 2010 19:39
Show Gist options
  • Save PJensen/328256 to your computer and use it in GitHub Desktop.
Save PJensen/328256 to your computer and use it in GitHub Desktop.
@ECHO OFF
REM The following applies trigger patches to the selected database using
REM a preset username catalog and password.
ECHO Setting db connection information
SET dbUser=[[UserNameHere]]
SET dbCatalog=[[CatalogNameHere]
SET dbServer=[[ServerNameHere]
ECHO ***
ECHO Server: %dbServer%
ECHO Catalog: %dbCatalog%
ECHO User: %dbUser%
ECHO ***
ECHO *** SQL files to execute.
ECHO ***
FOR %%c in (*.sql) DO echo %%c
ECHO * Enter 1 to quit and 2 to continue.
CHOICE /C:12
IF ERRORLEVEL 2 GOTO GO
IF ERRORLEVEL 1 GOTO QUIT
:GO
FOR %%c in (*.sql) DO OSQL -S %dbServer% -U %dbUser% -d %dbCatalog% -i %%c < password_input.pw
:QUIT
PAUSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment