How to use comparison keys in .xml files?

j.salmonj.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.

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi,

    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:
    &lt;?xml version="1.0"?&gt; 
    &lt;commandline&gt; 
    &lt;server1&gt;localhost&lt;/server1&gt; 
    &lt;server2&gt;localhost&lt;/server2&gt; 
    &lt;database1&gt;WidgetDev&lt;/database1&gt;
    &lt;database2&gt;WidgetLive&lt;/database2&gt;
    &lt;include&gt;Table:Widgets&lt;/include&gt; 
    &lt;comparisonkeys&gt;Widgets:PK_Widgets&lt;/comparisonkeys&gt;
    &lt;verbose/&gt; 
    &lt;/commandline&gt;
    

    ...but this does not work:
    &lt;?xml version="1.0"?&gt; 
    &lt;commandline&gt; 
    &lt;server1&gt;localhost&lt;/server1&gt; 
    &lt;server2&gt;localhost&lt;/server2&gt; 
    &lt;database1&gt;WidgetDev&lt;/database1&gt;
    &lt;database2&gt;WidgetLive&lt;/database2&gt;
    &lt;include&gt;Table:Widgets&lt;/include&gt; 
    &lt;comparisonkeys&gt;Widgets:RecordID&lt;/comparisonkeys&gt;
    &lt;verbose/&gt; 
    &lt;/commandline&gt;
    

    ...even though PK_Widgets is a primary key on the RecordID column.
  • j.salmonj.salmon Posts: 44 Bronze 2
    Hey Brian,

    Thanks for the info!
  • j.salmonj.salmon Posts: 44 Bronze 2
    I have another question on this. There are several tables in the database which don't have a specified PK or index (I dunno, I didn't create the tables).

    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
  • j.salmonj.salmon Posts: 44 Bronze 2
    I found in a previous thread that this is not possible. Can this be added as a future feature request? The new feature should take into account the following:

    <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
  • Hi,

    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
    Robert Chipperfield
    Red Gate
Sign In or Register to comment.