How does the Microsoft tablediff utility work?
It's a hectic task for DBA’s to fix the mismatched data in the SQL Server replicated tables.
The records in the subscriber table may get manually deleted or updated or may differ due to some other reasons.
Microsoft provides the native tool tablediff to compare the table against another SQL Server table.
We need to give below basic arguments as input in order to find the table differences.
- Source server name
- Source database
- Source table
- Source login
- Source password
- Destination server name
- Destination database
- Destination table
- Destination login
- Destination password
Here is the basic syntax to use tablediff utility
Here is the example that compares 2 tables.
The below output will be displayed when we run the tablediff utility in mentioned format,
If we need a T-SQL script to synchronize both the tables, include -f option and a file name.
The below output will be displayed on the screen,
The output T-SQL file be like
Senior Database Reliability Engineer at CRED
5 年Sujith, It's Awesome!! Thanks for sharing...