How to use comparison keys in .xml files?
j.salmon
Posts: 44 Bronze 2
How do you specify a comparison key in a .xml file?
<?xml version="1.0"?>
<commandline>
<server1>db1</server1>
<server2>db2</server2>
<include>Table:ImportStatus</include>
<comparisonkeys>ImportStatus:PlantNum</comparisonkeys>
<synchronize/>
<verbose/>
</commandline>
When using the above syntax I recv the following error:
Error: Invalid comparison keys specified for [dbo].[ImportStatus] 'PlantNum'. Only a single key or index may be specified.
Also, how do you specify multiple columns for a composite key?
Thanks.
<?xml version="1.0"?>
<commandline>
<server1>db1</server1>
<server2>db2</server2>
<include>Table:ImportStatus</include>
<comparisonkeys>ImportStatus:PlantNum</comparisonkeys>
<synchronize/>
<verbose/>
</commandline>
When using the above syntax I recv the following error:
Error: Invalid comparison keys specified for [dbo].[ImportStatus] 'PlantNum'. Only a single key or index may be specified.
Also, how do you specify multiple columns for a composite key?
Thanks.
Comments
I'm sorry this appears to be undocumented. I had a look into it and comparisonkeys seems to expect the name of an index rather than a column. For instance, this works:
...but this does not work:
...even though PK_Widgets is a primary key on the RecordID column.
Thanks for the info!
If I run SQL data compare through the GUI, I can manually map the column and the data copies fine. How can I achieve this using the comparisonkeys from commandline ?
For example, I am trying to copy a table called TransferCodes with these for columns:
TransferCodeID,
Code,
Source,
Dest
TransferCodeId is unique, although it does not contain an index. If I use the following comparison, the comparison fails (because it's the column name vs. index name):
<include>Table:TransferCodes</include>
<comparisonkeys>TransferCodes:TransferCodesID</comparisonkeys>
What is data compare setting differently though the GUI which is not being set through an arg file?
Jon
<include>Table</include>
<include>Table:TransferCodes</include>
<comparisonkeys>TransferCodes:TransferCodeID</comparisonkeys>
The comparison can be completed using a column name vs. index. Also, if a specific table + comparison are defined, the specified settings should be used (instead of any default setting created with the <include>Table</include> option).
Jon
It's certainly something we'll consider for the future, but in SDC 6 you'll now be able to use the mappings you set up in the GUI projects - so you can set up the mappings there, then use them on the command line.
Hope that helps,
Robert
Red Gate