TableDiff is one of many command line utilities in SQL Server 2005. It helps to determine differences between tow tables or views. One of these is taken as source and other as destination. This utility can report differences on schema and data. Although this utility is primarily designed for comparing replicated tables, but we can use it to compare tables.
To invoke the utility. Go to command prompt and access com folder of SQL Server 2005 installation there.
Then entered following command to compare tables through this utility.The command takes a few basic parameters to run.
Here tablediff is key word to invoke the functionality. All words starting with – are reserve words and are self explainatory. All words between the quotes are in your parameters and are linked to ancestor word starting with -. As you enter this whole command your parameters are echoed and result of comparison is generated.
Another powerfull feature is generation of SQL Scripts for the differences that it found between two tables. For that u just have to add -f as additional flag and also have to provide path and name for script.
Other options can be used in the TableDiff Utility. They can be found by executing the following command:
C:Program FilesMicrosoft SQL Server90COM>tablediff /?