-3

I need to get the hash function on the particular table that represents 1 million records in that table that is running on DB server A. so that I can compare this particular hash function with another hash function for the same table that is running on DB server B to check the data in that particular tables is same on both DB servers.

I don't know whether the right way to do it to compare the data on the same tables on different DB servers? please suggest if I'm in the wrong direction.

James Z
  • 12,209
  • 10
  • 24
  • 44
Dev9321
  • 25
  • 5

1 Answers1

1

You cannot get HASH for whole table. But, you can get at row level. You can take the primary key and see if the hash is matching between two tables.

There are many functions to support this:

They are accurate, but in extreme cases, it can be wrong. Read this SO post

But, for comparing these two tables, you can create linked server and use EXCEPT clause to see, if data are different.

There are many ways to compare table data. Refer to this post: https://www.mssqltips.com/sqlservertip/2779/ways-to-compare-and-find-differences-for-sql-server-tables-and-data/

Venkataraman R
  • 12,181
  • 2
  • 31
  • 58