HTML reports are generated for identical comparisons
Published 13 December 2022
If you are using the SQL Compare command line interface to automate schema comparison and report generation, you may have noticed that a report is still generated when the schemas are identical.
Currently it is not possible to set the job to only create the report if the schemas are different, as the report will be generated before the error code indicating no differences is returned. This results in a somewhat unhelpful blank report being created in the folder.
As a possible workaround, you could configure the batch file to delete the report if the schemas are identified as identical. .
Errorlevel 63 will be returned if the schemas are the same, which can be used to delete the report. Here is an example batch file:
"C:\program files\red gate\sql compare 7\"sqlcompare /s1:(local) /s2:(local) /db1:TempA /db2:TempB /report:"E:\Temp\SQL Compare Reports\report.html" /rt:simple /force IF %ERRORLEVEL% == 0 GOTO end IF %ERRORLEVEL% == 63 GOTO identical :identical del "E:\temp\SQL Compare Reports\report.html" :end