I have a batch file called dbcompare.bat
, and I use it to run a tool that compares databases. I want to compare a bunch of databases, so I made a second batch file, let's call it dbcompare-all.bat
, which calls dbcompare.bat
for each database in turn.
My problem is that when I run dbcompare-all.bat
, only the first database is compared; the other calls to dbcompare.bat
don't seem to execute. Why is this? How can I fix it?
Here's the dbcompare-all.bat
:
@echo off
rem syntax: dbcompare-all.bat sa password123
dbcompare.bat system db1 %1 %2
dbcompare.bat system db2 %1 %2
dbcompare.bat system db3 %1 %2
dbcompare.bat system db4 %1 %2
dbcompare.bat system db5 %1 %2
dbcompare.bat system db6 %1 %2
And here's the dbcompare.bat
:
@echo off
rem syntax: dbcompare.bat system dbname sa password123
echo Platform is %1
echo Partner DB is %2
echo DB username is %3
sqlpackage /Action:Script /DeployReportPath:%1.%2.xml /DeployScriptPath:%1.%2.sql /TargetDatabaseName:%2 /TargetPassword:%4 /TargetServerName:%1.ourcompanyname.us /TargetUser:%3 /SourceFile:%1.dacpac > %1.%2.out.txt 2> %1.%2.err.txt