Sql Data Compare: Command Line Help

NirmalNirmal Posts: 2
I want to data compare of two database tables.
if I want to use command line syntex, how to write command line for only compare of two table and insert only new rows in target database table.

Comments

  • Eddie DEddie D Posts: 1,647 Rose Gold 5
    Thank you for your post into the forum.

    The SQL Data Compare Help File ->Command Line Interface section, contains examples on what you are seeking.

    Also if you run the following command line syntax, this will generate further help information:
    SQLDataCompare /help /html > CLIHelp.html

    This will create a html file called CLIHelp in your SQL Data Compare installtion folder.

    An example Command Line Syntax is as follows:

    SQLDataCompare.exe /server1:<Server1_Name> /server2:<Server2_Name> /database1:<DB1_Name> /database2:<DB2_Name> /username1:<database1 username> /password1:<password> /username2:<database2 username> /password2:<password> /Include:Table:\[Table1_Name\] /Include:\[Table2_Name\] /sync

    The above syntax will compare just the two tables and synchronize them. You cannot set the synchronization to be only the new rows. In that the changes are migrated to <database2> from <database1>, so that the tables selected in the comparison will become identical.

    Hope the above information helps.

    Many Thanks
    Eddie
    Eddie Davis
    Product Support Engineer
    Redgate Software Ltd
    Email: [email protected]
  • Eddie DEddie D Posts: 1,647 Rose Gold 5
    Quick update to my previous reply.

    Please disregard this line in my reply:
    You cannot set the synchronization to be only the new rows. In that the changes are migrated to <database2> from <database1>, so that the tables selected in the comparison will become identical.

    I forgot about the following options:

      /ignoreidentical - Do not compare rows that are the the same in both databases. /ignoredifferent - Do not compare rows that are different in both databases. /ignoremissing - Do not compare rows that are present only in <database1>. /ignoreadditional - Do not compare rows that are only present only in <database2>.

    As you only wish to add new rows of data to the target database <database2>, please take a look at the following command line syntax:
    SQLDataCompare.exe /server1:&lt;Server1_Name&gt; /server2:&lt;Server2_Name&gt; /database1:&lt;DB1_Name&gt; /database2:&lt;DB2_Name&gt; /username1:&lt;database1 username&gt; /password1:&lt;password&gt; /username2:&lt;database2 username&gt; /password2:&lt;password&gt; /Include:Table:\&#91;Table1_Name\&#93; /Include:\&#91;Table2_Name\&#93; /ignoreidentical /ignoreadditional /sync
    
    In my example syntax above the comparison will only compare and synchronize rows of data that exist in <database1> and rows off data that are different in both databases. If you wish to compare and synchronize the rows of data that exist only in <database1> add the /ignoredifferent argument to my example syntax.

    Sorry for the confusion.

    Many Thanks
    Eddie
    Eddie Davis
    Product Support Engineer
    Redgate Software Ltd
    Email: [email protected]
Sign In or Register to comment.