Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summary of the BINARY_CHECKSUM() Function in SQL Server #1344

Open
kfrural opened this issue Sep 23, 2024 · 0 comments
Open

Summary of the BINARY_CHECKSUM() Function in SQL Server #1344

kfrural opened this issue Sep 23, 2024 · 0 comments

Comments

@kfrural
Copy link

kfrural commented Sep 23, 2024

Functionality of BINARY_CHECKSUM()

Calculates a binary checksum value over a row or list of expressions
Returns the same value for a row as long as it isn't modified later
Satisfies hash function properties:
    Same output for equal inputs 
    Output changes if input changes 

Key Characteristics

Ignores columns of non-comparable data types in computation
Supports varbinary(max) of any length and nvarchar(max) up to 255 characters
More precise than CHECKSUM() but with higher computational overhead
May have occasional collisions, so should only be used if application can tolerate undetected changes 

Alternatives

HASHBYTES() is more precise but has additional overhead
Snowflake standard hash functions like SHA256() can be used as alternatives
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant