Returns a SHA-2 checksum in hexadecimal form. The bit length can be 224, 256, 384 or 512, and 0 is treated as 256.
Read more: Databricks docs
In the Ultra Transcenders books
Each book explains sha2 in context, with comparison tables and the common traps.
Terms in this definition
- RETURNS
States what a function gives back, as a type or a table, inside
CREATE FUNCTION. SQL functions can leave it out and have the type worked out from their body. - Checksum
Confirms that a check digit in text found by a custom sensitive information type's regex is correct, calculated from weights and a mod value. The advanced version can only be set up in PowerShell XML.
- LENGTH
Counts the characters in a string, or the bytes in binary data, in SQL.
char_lengthandcharacter_lengthare other names for it.
Related terms
- hash function
Produces an
INTEGERfrom the arguments given to it, and the outcome varies with their data types. For a cryptographic digest, use something likesha2instead. - HASHBYTES
Hashes its input with an algorithm like SHA2_512 or SHA2_256 and gives back varbinary(8000). Storing that in a persisted column lets a unique constraint cover a value too large to index directly.
- Secure Hash Algorithm
A family of hashing algorithms. In Databricks SQL,
sha2produces SHA-2 hashes such as SHA-256, and that offers one means of masking a column.