:attach
@echo off
cls
set /p dBname="2004.5.6 Schema Updates. Type in your database name > "

if NOT exist c:\"Program Files\Microsoft SQL Server\MSSQL\Data"\%dBname%.mdf goto error
if NOT exist c:\"Program Files\Microsoft SQL Server\MSSQL\Data"\%dBname%.ldf goto error


osql -U sa -P advantagesystem -d %dbname% -i 2004_5_6_1.sql
osql -U sa -P advantagesystem -d %dbname% -i 2004_5_6_3.sql


exit

:error
cls
echo %dBname% does not exist
echo.
goto attach