- Tablediff gets installed with replication features
- Prepare Tablediff for multiple tables
- Run it from a batch file and log results in text file
- One Click Results Displayed :). Tested on SQL 2012
TableDiff.bat
cd "C:\Program Files\Microsoft SQL Server\110\COM"
tablediff.exe -sourceserver SourceDBServerIP -sourcedatabase TestDB -sourcetable Table1 -destinationserver DestDBServerIP -destinationdatabase TestDB -destinationtable Table1 -c -dt DiffsTable1
tablediff.exe -sourceserver SourceDBServerIP -sourcedatabase TestDB -sourcetable Table2 -destinationserver DestDBServerIP -destinationdatabase TestDB -destinationtable Table2 -c -dt DiffsTable2
Explanation
- Option –c - Perform column level comparisons
- Option –dt – Output different records to particular table (drop and create if exists)
- By checking the log and the diff tables created we can find error code and description of differences
- By adding -strict option it expects the same schema (column order). I have not used it in above example
- Add -sourceuser, -sourcepassword , -destinationuser, -destinationpassword parameters in case of sql credentials. If not specified windows credentials will be used
RunTD.bat
C:\\TableDiff.bat > C:\\TableDiffResults.txt 2>&1
One Click RunTD.bat and check logs for results. SO link
Happy Learning!!!
No comments:
Post a Comment