Comments
3 comments
-
If you want to compare/deploy many databases together, your best bet is probably to call the command line many times in a loop; SQL Compare compares two databases at a time, deploying changes from one to the other.
-
Hi Sam,
your best bet is probably to call the command line many times in a loop > Where I can retrieve the comparison script?
Thank you. -
The best implementation depends on your choice of language and what you want to do. For example if you wanted to use Powershell this method might be handy:
function Get-DBList ($server) { $srv = New-Object 'Microsoft.SqlServer.Management.Smo.Server' $server $srv.Databases | Select name, RecoveryModel, @{Label="CompatibilityLevel";Expression={($_.CompatibilityLevel).ToString().Replace("Version", "")}} } #end Get-DBList
From http://dba.stackexchange.com/questions/ ... -databases
And you could loop through the resulting collection calling SQLCompare.exe with arguments for whatever you wanted to do. The script shouldn't be too hard to write, but it won't produce an interactive experience like the SQL Compare UI.
I hope this helps.
Add comment
Please sign in to leave a comment.
Can I choose to compare all databases under a instance instead of choose one by one to do comparison?
Thank you.
Regards,
Justin