Saurabh Mehta
Saurabh Mehta

Reputation: 141

Data Comparison between SAP Hana and SQL Server

I am working on a solution to compare Datasets from SAP HANA and Azure SQL Server to check consistency of data on SQL server. Instead of getting all the fields from HANA and doing an "except", I was thinking of evaluating and comparing a Checksum or Hashbytes on both systems.

However, the Hashvalues for same data is not matching.

Hash Values on SAP HANA SELECT HASH_MD5(MANDT), HASH_SHA256(MANDT) from SLT_DECO100.MSKU where CHARG = 'UK2031RP' and WERKS = 'U72D'

0x25DAAD3D9E60B45043A70C4AB7D3B1C6 0x47DC540C94CEB704A23875C11273E16BB0B8A87AED84DE911F2133568115F254

Hash Values on SQL Server select HASHBYTES('MD5', MANDT), HASHBYTES('SHA2_256', MANDT) from consolidation.MSKU where CHARG = 'UK2031RP' and WERKS = 'U72D'

0xA4DC01E53D7E318EAB12E235758CFDC5
0x04BC92299F034949057D131F2290667DE4F97E016262874BA9703B1A72AE712A

Need support to understand and perform comparison

Upvotes: 0

Views: 858

Answers (1)

RajkumarPalnati
RajkumarPalnati

Reputation: 689

  • The hash values could be different based on algorithms what we are using.

  • Here in the below link comparing the data from two different environments of same tables by providing the pipe delimiters in query.

  • The pipe delimiters will separates the data from column to column then it gives the accurate results.

Check here for Compare Records Using Hash Values.

Note: More information for the below text in Microsoft Docs,

  • Algorithms (MD2, MD4, MD5, SHA & SHA1) are deprecated starting with SQL Server 2016 (13.x).

  • Use SHA2_256 or SHA2_512 instead. Older algorithms will continue working, but they will raise a deprecation event.

Upvotes: 1

Related Questions