SQL Compare Command Line w/Filter

LukeRogersLukeRogers Posts: 3
edited February 11, 2015 10:53AM in SQL Compare Previous Versions
As part of my CI build I need to sync only the Views and to do this I am using a saved Filter. Here is the command I am running:

SQLCompare.exe /database1:DB1 /s1:SERVER /database2:DB2 /s2:SERVER /Filter:C:CompareFilterviewsonly.scpf /synchronize

If there are changes to be synchronized everything works great but if the databases are identical I get
"Error: The selected objects are identical or no objects have been selected in the comparison."
Since this is a filter I can't use /Include:Identical and I can't find any way around getting this error. It makes my CI builds look like they have issues when in fact they don't so when I DO have an issue it's easy to miss since it looks the same (error).

Am I missing something? Is there something I can do to suppress this error since it's there are no changes necessary?

Comments

  • Hi Luke,

    You didn't mention which version of SQL Compare you were using, but you should be able to use the /Assertidentical switch to suppress the error and return an exit code of 0 if the databases are identical.
    Software Engineer
    Redgate Software
  • My servers are currently on 10 but I am able to test on 11 to upgrade if necessary.

    When I try the /AssertIdentical flag with version 11 I get the following error:
    Error: The /assertidentical switch cannot be used in conjuntion with the /synchronize switch.

    I was hoping to have everything handled in one step but if I need two steps (check if there are changes, if so, synchronize) I'm okay with it, I just don't know how to do it. Any ideas?
  • LukeRogers wrote:
    I was hoping to have everything handled in one step but if I need two steps (check if there are changes, if so, synchronize) I'm okay with it, I just don't know how to do it. Any ideas?

    What you could do is detect the value of the environment variable %ERRORLEVEL% and if it is equal to 0, proceed with the synchronization step.

    How are you currently handling your CI? Have you had a look at our SQL Automation Pack? You might also want to have a look at our Continuous Integration page that is part of our Database Lifecycle Management section.
    Software Engineer
    Redgate Software
Sign In or Register to comment.