Competition: What’s your favorite Redgate tool? Enter now.

Error using SQLDataCompare command line and ExcludeColumns

RichRRichR Posts: 7
I have an issue using the command line version of SQLDataCompare (version 8.1.0.4). I'm trying to run a comparison of the 'Distribution' table, but I want to ignore the 'last_mod_dt' column.

When running a full table comparison, everything works as expected. The following command works just fine...
sqldatacompare.exe /server1:Server1 /server2:Server2 /db1:Database1 /db2:Database2 /include:table:\[Distribution\]


However, once I add the "ExcludeColumns" parameter, I receive an error, "Error: Object reference not set to an instance of an object.". I've tried multiple combinations, but nothing seems to work.

All of the following produce the error...

sqldatacompare.exe /server1:Server1 /server2:Server2 /db1:Database1 /db2:Database2 /include:table:\[Distribution\] /ExcludeColumns:Distribution:last_mod_dt

sqldatacompare.exe /server1:Server1 /server2:Server2 /db1:Database1 /db2:Database2 /include:table:\[Distribution\] /ExcludeColumns:\[Distribution\]:\[last_mod_dt\]

sqldatacompare.exe /server1:Server1 /server2:Server2 /db1:Database1 /db2:Database2 /include:table:\[Distribution\] /ExcludeColumns:\[Distribution\]:last_mod_dt



The command line output is...

Comparing database Server1.Database1 with database Server2.Database2...
Registering databases
Mapping
Comparing databases
Error: Object reference not set to an instance of an object.

C:\Program Files\Red Gate\SQL Data Compare 8>
-Rich

Comments

  • Hi there,

    Please can you try the following syntax and let me know how you get on:
    sqldatacompare.exe /server1:Server1 /server2:Server2 /db1:Database1 /db2:Database2 /include:table:\[Distribution\] /ExcludeColumns:Distribution:"last_mod_dt"
    

    Many thanks!

    Pete
    Peter Peart
    Red Gate Software Ltd
    +44 (0)870 160 0037 ext. 8569
    1 866 RED GATE ext. 8569
  • Thanks Peter, I will try it this morning and get back to you.
    -Rich
  • Peter - The option you suggested did not work. I am still receiving the same error.
    -Rich
  • More information:

    The table and column names have different capitalization.

    In Database1 - DISTRIBUTION.LAST_MOD_DT

    In Database2 - Distribution.Last_Mod_Dt
    -Rich
  • Hi Rich,

    The capitalization shouldn't matter. Is there any chance of getting backups of these DB's so I can see if I can replicate the issue here?

    Pete
    Peter Peart
    Red Gate Software Ltd
    +44 (0)870 160 0037 ext. 8569
    1 866 RED GATE ext. 8569
  • Peter,

    I'm setting up an example that I can provide you. I've found that it has something do to with there being more than one table with the selected name in the database (i.e., if we have Distribution, Distribution_To, Distribution_From in the source and destination databases, then the error occurs).

    I will package up a set of example scripts for you today. How can I deliver the files to you?
    -Rich
  • Peter,

    I have isolated the issue. It is not related to table names as I thought earlier. The error occurs when the table listed in the "db2" database has extra columns that are not in the table on the "db1" database AND you attempt to use those extra columns in the ExcludeColumns parameter. The error does not occur when you switch the position of the two databases.

    I have created scripts that illustrate the issue. Let me know how and I will send them to you.
    -Rich
  • Hi Rich,

    If they aren't too large, you can send them to support(at)red-gate.com using reference F0034908.

    If you want to include the specific batch file you are running as well (in text format otherwise it will get stripped) that would be great.

    Many thanks!

    Pete
    Peter Peart
    Red Gate Software Ltd
    +44 (0)870 160 0037 ext. 8569
    1 866 RED GATE ext. 8569
Sign In or Register to comment.