Selecting Single Tables for Comparison |
See Also |
This example illustrates how you select a single table for comparison.
In this example, the databases contain the following tables (amongst others):
You are interested only in the differences between the Product tables in two different versions of your database; you are not interested in any of the other tables, or any views in the databases.
To specify the table to include, you use the /include switch:
SQLDataCompare /db1:Products1 /db2:Products2 /include:table
/include:table:\[Product\] /verbose
where:
specifies that you want to compare the database Products1
specifies that you want to compare the database Products2
specifies that you want to compare only tables; you do not want to compare views. If you omit this argument, SQL Data Compare compares all tables that have names that match the second /include switch and all views in the databases.
To specify more than one object type for inclusion, use multiple /include switches. For example, to include only tables and views, enter:
/include:table /include:view
specifies that you want to compare only the table that has a name that includes the string [Product]
Note that you use .NET standard regular expressions to define the /include and /exclude arguments. Therefore, you must escape the square brackets ( [ ] ) with the backslash character ( \ ). Regular expression syntax is beyond the scope of this online Help; refer to your Microsoft .NET framework documentation for more information.
You must include the brackets ( [ ] ) in the string; if you specify the argument without the brackets, /include:table:Product, all of the tables listed above are included, because they all contain the string Product. The full SQL Server table names are qualified by the owner name in SQL Server 2000, and the schema name in SQL Server 2005, and include brackets. For example (SQL Server 2000):
and so on. Therefore, the brackets indicate that you are specifying the full table name. To include the owner (or schema) name in the regular expression, you would need also to escape the dot ( . ):
/include:table:\[dbo\]\ .\[Product\]
specifies that you want to display detailed information about differences between objects
You can use XML as follows:
<?xml version="1.0"?> <commandline> <database1>Products1</database1> <database2>Products2</database2> <verbose/> <include>Table</include> <include>Table:\[Product\]</include> </commandline>
To execute the comparison using the XML file, enter the following command:
SQLDataCompare /argfile:xmlfilename.xml
where xmlfilename is the name of the XML file.
© Red Gate Software Ltd 2007. All Rights Reserved.