How does the Microsoft tablediff utility work?

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

No alt text provided for this image

Here is the example that compares 2 tables.

No alt text provided for this image

The below output will be displayed when we run the tablediff utility in mentioned format,

No alt text provided for this image

If we need a T-SQL script to synchronize both the tables, include -f option and a file name.

No alt text provided for this image

The below output will be displayed on the screen,

No alt text provided for this image

The output T-SQL file be like

No alt text provided for this image


Murali A

Senior Database Reliability Engineer at CRED

5 年

Sujith, It's Awesome!! Thanks for sharing...

要查看或添加评论,请登录

Sujith T的更多文章

  • Columnstore Index in SQL Server

    Columnstore Index in SQL Server

    Column store indexes column segment based data storage for each column thereby reducing the cost of storage since it…

  • Overview on SQL Server Database Snapshots

    Overview on SQL Server Database Snapshots

    Database snapshot is a read only static collection of a source database.Multiple snapshot can be created for a single…

  • Cassandra Backup and Restoration

    Cassandra Backup and Restoration

    Apache Cassandra is a highly scalable, high-performance distributed database designed to handle large amounts of data…

社区洞察

其他会员也浏览了