2

We currently use a house written PS script to compare developers' local SQL databases with live databases to generate deployment scripts. We use Redgate SQL Compare through powershell, typically calling it as such (where $SQLComparepath is the file path of the executable for SQLcompare):

$AllArgs = @("/server1:$DevServer", "/Database1:$DevDB", "/Scripts2:$folder", "/Include:$type", "/Include:$type:\[$schema]\.\[$name]", '/Synchronize')

&$SQLComparePath  $AllArgs

We find that while this works, it takes a long time to generate scripts for large numbers of objects since we are calling the exe serially for each object. I've searched through the documentation and don't see any way of passing more than one set of arguments at a time. Does anyone know of a more efficient way of calling SQL Compare, through powershell or otherwise?

Thanks!

Ben Adams
  • 129
  • 1
  • 2
  • 11
  • 1
    If you are looking to parallelize PowerShell, [Start-ThreadJob](https://learn.microsoft.com/en-us/powershell/module/threadjob/start-threadjob?view=powershell-7) may be an option here. If you are looking how to better use SQL Compare, that's a different concept. – AdminOfThings Apr 13 '20 at 20:25
  • 1
    It sounds like you're trying to parallelize it, but maybe running it in multiple batches is the issue. Why not compare across a wider spread of objects? – Grant Fritchey Apr 14 '20 at 10:05
  • Not necessarily parallelize it; I was hoping to find a way to just pass more than one object into sqlCompare at a time. Though parallel executions could be a possibility if there is no other option – Ben Adams Apr 14 '20 at 13:50

0 Answers0