hashbytes

/*
Checksum() isnt very good for detecting data changes. Use hashbytes() instead
Example of output from script below:
-361975519341300.801789
*/


select avg(cast(cast(hsh as bigint) as decimal(25,0))) as truncatedHash
from (
select cast(HASHBYTES('SHA1',
[StringField1]+
[StringField2]+
[StringField3]) as binary(20)) as hsh
FROM dbo.TableToBeInvestigated
) as hashedData

Comments

Popular posts from this blog

Constructing nested array structs in BigQuery

How to decrypt stored password from SSMS registered servers

Cause for Parameter is incorrect 0x80070057 error in ssis