Competition: What’s your favorite Redgate tool? Enter now.

SQL Compare 11 can compare all databases schema

justinmac88justinmac88 Posts: 3
edited August 17, 2016 11:33AM in SQL Compare 11
Hi All,

Can I choose to compare all databases under a instance instead of choose one by one to do comparison?

Thank you.



  • 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.
    Software Developer
    Redgate Software
  • 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 ... -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.
    Software Developer
    Redgate Software
Sign In or Register to comment.