SQL Data Compare
Latest version: 10.0
Knowledge Base
SQL Data Compare command-line XML argument file examples
Category: How do I?
Date: 16 Jul 2009
Product: SQL Data Compare
Versions: 6.x,7.x, 8.x
The command-line component of SQL Data Compare that may be used to run comparisons on a schedule or as part of a batch of synchronization processing can be configured using an XML file to specify the objects that will be included and the options for comparing data. The XML command files correspond roughly to what is available via command-line, but there are a few subtle differences. This article contains examples of XML argument files for SQL Data Compare's command-line component.
To specify an XML argument file to SQLCOMPARE.exe or SQLDATACOMPARE.exe, the /argfile:<filename.xml> argument is used in place of any other command-line arguments.
Including only certain columns in a data comparison of a table:
<?xml version="1.0"?>
<commandline>
<database1>TestDataBase</database1>
<database2>TestDataBase2</database2>
<columns>testTable:testdate,test_id</columns> <!-- Include only the testdate and test_id columns from the table testTable -->
</commandline>
Including all tables tables except WidgetReferences and excluding all views:
<?xml version="1.0"?>
<commandline>
<server1>localhost</server1>
<server2>localhost</server2>
<database1>WidgetDev</database1>
<database2>WidgetLive</database2>
<include>Table</include>
<exclude>Table:\[WidgetReferences\]</exclude>
<verbose/>
</commandline>
Exclude all tables owned by Support, or in the Support schema, using SQL authentication on the first server and Windows on the second:
<?xml version="1.0"?>
<commandline>
<server1>localhost</server1>
<username1>sa</username1>
<password1>P@ssw0rd</password1>
<server2>localhost</server2>
<database1>WidgetDev</database1>
<database2>WidgetLive</database2>
<exclude>Table:\[Support\].\[</exclude>
</commandline>
Compare all tables and views whose names begin with 'Widget', except for WidgetReferences:
<?xml version="1.0"?>
<commandline>
<server1>localhost</server1>
<server2>localhost</server2>
<database1>WidgetDev</database1>
<database2>WidgetLive</database2>
<exclude>Table:\[Widget^(References)</exclude>
</commandline>
Specifying a custom comparison key: Cannot be done from the command-line. For this, use the SQL Data Compare Interface to create a project file, and use this project file from the command-line program with the /pr argument.
Specifying a WHERE clause from an XML command file is not supported either, and must be accomplished using a project file in the same ways as specifying a comparison key.
Erasing the default comparison options and adding the options 'output comments' and 'disable triggers' and outputting a synchronization script:
<?xml version="1.0"?>
<commandline>
<database1>WidgetDev</database1>
<database2>WidgetLive</database2>
<options>n,oc,t</options>
<scriptfile>migration.sql</scriptfile>
</commandline>
Adding the verbose switch to cause more information about the comparison process to be written:
<?xml version="1.0"?>
<commandline>
<database1>WidgetDev</database1>
<database2>WidgetLive</database2>
<verbose/>
</commandline>
Comparing a live database to a backup file (version 6 and up):
<?xml version="1.0"?>
<commandline>
<backup1>D:\MSSQL\BACKUP\BackupOfFirstDatabase.sqb</backup1>
<database2>SecondDatabaseName</database2>
</commandline>
Document ID: KB200711000189 Keywords: SQL, Data, Compare,XML,command,exclude,include,batch,schedule
Was this article helpful?
SQL Data Compare
- Logging and log files
- Internal Connection Fatal Error in versions 4 and 5
- NULL textptr passed to UPDATETEXT function when running synchronization
- How much free hard disk space is required?
- Comparing the data of two tables in the same database
- Suggestions to combat comparison and synchronization performance issues
- SQL comparison and synchronization automation capabilities
- SqlNullValueException occurring in synchronization wizard
- SQL Data Compare command-line XML argument file examples
- Using Windows authentication logons between domains
- Using a filter on a column on related (joined) tables
- Determining minimum database permissions for SQL Data Compare
- Tables with compound keys may not be mapped automatically
- Best practices for synchronizing data
- Cleaning up a SQL script after SQL Compare or SQL Data Compare
- Troubleshooting System.OutOfMemoryException during comparison
- Exception thrown by db reader 1
- Reseed applying "incorrect" identity values
- Running migration scripts using SqlCmd.exe
- This SQL Server has been optimized for x concurrent queries.
- SQL Data Compare showing differences in 2 identical databases
- How to force SQL Compare and SQL Data Compare to use an Encrypted Connection
- Improving the performance of SQL Data Compare
- Logging and log files
- Case-sensitive comparisons
- Tables or views that could not be compared
all SQL products
- Compatibility of Red Gate tools in 64-bit environments
- Application has encountered an error and needs to close
- Error message after installing SQL Toolbelt - The description for Event ID ( 1 ) in Source ( nview_info ) cannot be found.
- Changing the temporary directory used by the installer
- Toolbelt Installer "hanging" while "scanning volumes"
- Login failing with "trusted SQL Server connection" error when using RunAs
all products
- Some Red Gate products identified as containing a trojan by Anti-Virus software
- Activation may fail with Unknown Error -1
- Product uses web help although a CHM file is available locally
- Argument exception resulting from missing environment variable
- Check for updates may fail when used through proxies
- 'Unidentified Publisher' error when repairing or uninstalling
- Licensing activates product as standard edition
- Moving Red Gate software products to another machine
- Red Gate tools log locations
- The application UI opening slowly when there is no internet access
SQL Data Compare
- Activating your products
- Activating your products
- Getting help offline
- Getting better performance out of SQL Data Compare
- Release notes - version 10.xx
- SQL Data Compare release notes - version 7.xx
- SQL Data Compare release notes - version 8xx
- SQL Data Compare release notes - version 9.xx
all SQL products
all products
- Red Gate product acknowledgements
- Activating your products
- Activating your products
- Red Gate bundle history
- Check for updates
- Troubleshooting Check for Updates errors
- Current versions
- Deactivating your products
- Installing Red Gate products from the .msi file
- Requesting additional activations
- Serial numbers for bundles
- Reactivating using a different serial number
- Extending your trial
- Finding your serial numbers
- Moving a serial number from one computer to another
- No response received for manual activation
- Licensing and activation resources
- Licensing and activation resources
- Troubleshooting licensing and activation errors
- Licensing and activation FAQs
- Red Gate tools log file locations
- Download old versions of products
- Download product prerequisites & utilities
- Support & upgrades
- Upgrading your software
- Upgrading FAQs

Using SQL Data Compare