Tuesday, June 24, 2014

One way to deploy database for SQL Server

For using sqlcmd , see:
http://msdn.microsoft.com/en-us/library/ms180944.aspx


put this in a batch file:

set UName=smedlyuser
set DbName=funbeanweb
#set SName=localhost/SMEDLY
set SName=10.10.10.299,5422
set Pwd=supersecretpassword

echo drop_tables.sql... > _output_.txt
sqlcmd -S %SName% -U %UName% -P %Pwd% -d %DbName% -I -i drop_tables.sql >> _output_.txt 2>&1
echo create_tables.sql... >> _output_.txt
sqlcmd -S %SName% -U %UName% -P %Pwd% -d %DbName% -I -i create_tables.sql >> _output_.txt 2>&1
echo thing_data.sql... >> _output_.txt
sqlcmd -S %SName% -U %UName% -P %Pwd% -d %DbName% -I -i thing_data.sql >> _output_.txt 2>&1

@notepad _output_.txt

No comments: