Data compare command line not working for different table names

SqlBoffinSqlBoffin Posts: 1 New member
edited November 28, 2019 2:58PM in SQL Data Compare

Hi,

So running into one wall after another. I have managed to get this to run when both tables have the same name but cannot get it to work when the names are different even when using the /include:different switch. Keeps flagging up 'invalid key - only one can be specified'. When I change the option to identical and change the table names to both the same, it works. What am I missing here?

"C:\Program Files (x86)\Red Gate\SQL Data Compare 14\SQLDataCompare.exe" /s1:svr /s2:svr /db1:redgate_Src /db2:redgate_trg /Include:table /Include:table:tableA^|TableB /IncludeColumns:TableA:\[edition_id\] /ComparisonKeys:TableA:PKDC002RHEditionsDatesSrcIndex /v /Include:DIFFERENT

Regards

T

Tagged:

Answers

  • I'm looking for an answer too on this, I've had the same issue trying to run this tool in cmd for different tables names. Though I did manage to get it to work for different table names in an alternative way. You could open the GUI, run the comparison and manually map the tables together, making sure the tick boxes are checked, then save the project file. Then you can call that project file in cmd. Though it's not what I wanted and it's probably the same for you.         

    Annoyingly Redgate Documentation states "However, if there are schema differences between the data sources, for example if two tables have different names, they may not be mapped automatically." Kind of implies that they can be automatically mapped if the names are similar but this is not the case, one character difference at the end and it doesn't match anything. 
  • Hi all,

    Unfortunately there is not a way to map tables on the command line; that is why there is the option to use a project file created in the UI on the command line, so you can map in the UI and then use it on the command line.

    There are currently no plans to implement this in the command line either, though you may want to create a SQL Compare Uservoice suggestion for it (or vote on one if someone has already done it by the time you see this) so the team can gauge popularity https://redgate.uservoice.com/forums/141379-sql-compare.

    You may be able to modify the project file XML programmatically (the mapping portion of the XML seems pretty straightforward) and then use that option on the command line, but that would not be a use case supported by us.

    Kind regards,

    Alex

    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
Sign In or Register to comment.