Hi,
I have been trying to figure out how to create a Batch file to automatically detach, delete and reattach a fresh sql2012 database. We use the databases for training and after each use we re-attach the fresh database. it is a tedious process as this needs to be done almost every day. I decided to try and automate this process, so far i have been able to detach, delete and attach a new database successfully but it drops the usernames and passwords and i do not understand why.
"C:\Program Files\Microsoft SQL Server\MSSQL11.SIMS2012\MSSQL\Binn\Dbattach.exe" /SERVER=".\sims2012" /DATABASE="Engwe0" /USER="SA" /PASSWORD="Password1" /AUTODETACHMODE /AUTO
pause
call "C:\Program Files\Microsoft SQL Server\MSSQL11.SIMS2012\MSSQL\DATA\delete.bat"
pause
"C:\Program Files\Microsoft SQL Server\MSSQL11.SIMS2012\MSSQL\Binn\Dbattach.exe" /SERVER=".\sims2012" /USER="SA" /Password="Password1" /DATABASE="ENGwe0" /SOURCEDB="D:\Keystone\november15traindata_sims7.166_engwe_sql/ENGwe0.mdf" /AUTOATTACHMODE /AUTO
pause
this is the first time i have attempted a script and also the first time I've posted here, i would greatly appreciate any thoughts you may have
Thanks In Advance!