@echo off
REM ie. --> Reset Version Error Login Lockout dBname


:SetOption
set /p dBname="Type in your database name > "
if [%dBname%] EQU [] goto noargs

REM SQL Server 2000
REM if NOT exist c:\"program files\Microsoft SQL Server\MSSQL\DATA"\%dBname%.mdf goto error
REM if NOT exist c:\"program files\Microsoft SQL Server\MSSQL\DATA"\%dBname%.ldf goto error

REM SQL Server 2008
REM if NOT exist C:\"Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA"\%dBname%.mdf goto error
REM if NOT exist C:\"Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA"\%dBname%.ldf goto error

osql -U sa -P advantagesystem -d %dBname% -Q "UPDATE Sys_AW_Options SET Control_Value = 0 WHERE Control_Type = 'CheckBox' AND Control_Name = 'chkLoginVersionError' AND Control_Index = 0"
exit


:noargs
goto SetOption

:error
cls
echo %dBname% does not exist
goto SetOption

