No transaction in XML argfile

si_hesi_he Posts: 25
Please can someone explain how I can set the commandline object to not use transactions within options?

I have tried using the following in the XML file:

<options>None</option> and <options> option1, option2.. option n </options>

But I receive the following error on mapping:

Error: Object reference not set to an instance of an object.

Thanks

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hello Simon,

    This should work as you describe. Possibly there is another cause for the error message? This sounds more like a failure in the program than an incorrect option. The message should read 'invalid option' rather than chucking a null-reference exception at you. I had tried something similar to your argfile, specifying the N (none) and oc (output comments) options, which has diabbled the transactions in the SQL script output by Data Compare:
    &lt;?xml version="1.0"?&gt;
    &lt;commandline&gt;
        &lt;database1&gt;WidgetDev&lt;/database1&gt;
        &lt;database2&gt;WidgetLive&lt;/database2&gt;
        &lt;verbose/&gt;
        &lt;options&gt;n,oc&lt;/options&gt;
        &lt;scriptfile&gt;migration.sql&lt;/scriptfile&gt;
    &lt;/commandline&gt;
    

    Maybe you should try these options, then if there is still a problem, use the GUI version of Data Compare and see if it throws a more 'friendly' error message.

    Thanks!
  • I receive the following output from using the verbose option and as you can see there is no compare or mapping.

    SQL Data Compare running with SQL Option: None (OK).
    SQL Data Compare running with Mapping Option: None (OK).
    SQL Data Compare running with Comparison Option: None (OK).
    SQL Data Compare running with SQL Option: OutputComments (OK).

    This must be the reason for the object reference not set error. I included 'includeidentities' in the <options> clause and it fixed the issue with my problem.

    Cheers
  • But it's still being run in a transaction!

    The GUI runs fine with the same settings.

    Help...
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Can you post your xml commandfile so we can have a look?

    Thanks!
  • <?xml version="1.0"?>
    <commandline>
    <database1>*****</database1>
    <server1>*****</server1>
    <username1>*****</username1>
    <password1>*****</password1>
    <database2>*****</database2>
    <server2>*****</server2>
    <include>Table</include>
    <include>Table:*****</include>
    <include>Table:*****</include>
    <columns>*****</columns>
    <include>Table:*****</include>
    <exclude>Table:*****</exclude>
    <exclude>Table:*****</exclude>
    <options>n</options>
    <synchronize/>
    </commandline>
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hello,

    It works differently for me if I use the default options or if I set options=n. With no options, the transactional stuff doesn't appear in the script. Are you on the latest version of SQLDATACOMPARE.exe? It should read 5.2.0.50.

    Thanks!
  • Yeah it's the latest version and I think I was premature in my thinking it was running in a transaction, it's running fine.

    I think a nice feature would be to have a script generater from the GUI settings to commandline or XML file.

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

    You can create projects in Data Compare and save them and run them from the command line. In Data Compare, right-click the project and select 'locate on disk'. Then you can copy the settings file to another folder and run it in sqldatacompare.exe using the /pr switch. One problem, the custom mappings don't seem to be respected.
Sign In or Register to comment.