Export HTML via "Generate Comparison Results Report" using Command Shell
There should be a way to Export HTML via "Generate Comparison Results Report" using Command Shell.
When we have a ".scp" file which contains the Information about the Databases to be compared, which is saved as a project.scp.
In this case, if we have a ".scp" file, then is there any command to export the html.?
-
Eric commented
(I'm just another user) I'm working with the commandline options for SQL Compare to create a batch file across our environment. Maybe you just need direction to this information.
https://documentation.red-gate.com/sc/using-the-command-line/options-used-in-the-command-line
You can have this also if useful for someone./*EXAMPLE creates html report for changes which would bring DB345 in sync with the baseline DB123*/
/* /force will allow overwrite of prior file*/
/* /quiet reduces commandline output*/
/*To automate changes, review use of /sync. not included in example */
declare @exeLocation varchar(500) = 'C:\Program Files (x86)\Red Gate\SQL Compare 14\SQLCompare.exe'
declare @Server1 varchar(100) = 'ABC\INSTANCE1' --SOURCE SERVER
declare @Server2 varchar(100) = 'ABC\INSTANCE2' --SECONDARY SERVER
declare @Database1 varchar(100) = 'DB123' --SOURCE DB
declare @Database2 varchar(100) = 'DB345' --SECONDARY DB
declare @ProjectPath varchar(500) ='D:\SQLCompare\SharedProjects\'
declare @ProjectName varchar(100) = 'Prod' --excludes file extension ".scp"
declare @FilterPath varchar(500) = 'D:\SQLCompare\SharedFilters\'
declare @FilterName varchar(100) = 'Only_StoredProc' --excludes file extension ".scpf"
declare @ReportPath varchar(500) = 'D:\SQLCompare\SharedReports\'
declare @ReportName varchar(500) = + REPLACE(@Server2,'\','_') + '_' + @Database2 + '.html'
declare @ReportType varchar(10) = 'html'
declare @additionalParameters varchar(100) =' /force /quiet' /*leading space*/
declare @runStmt varchar(max)
declare @quote char(1) = '"'
select @runStmt =
@quote + @exeLocation + @quote
+ ' /Server1:'+@Server1
+ ' /db1:' + @Database1
+ ' /Server2:'+@Server2
+ ' /db2:' + @database2
+ ' /project:' + @quote + @ProjectPath + @Projectname + '.scp' + @quote
+ ' /filter:' + @quote + @FilterPath + @FilterName + '.scpf' + @quote
+ ' /report:' + @quote + @ReportPath + @ReportName + @quote
+ ' /ReportType:' + @ReportType
+ @additionalParameters
print @runStmt