HASHBYTES (SQL)
Synopsis
HASHBYTES(algorithm,expression)
Description
The HASHBYTES function takes an algorithm and a column and returns a hashed value for an input column using a specified algorithm. This function currently supports the SHA256, SHA384, and SHA512 hash algorithms.
Arguments
algorithm
The hash algorithm the function uses to generate hash values. The algorithm name must be surrounded by single quotes (').
Supported algorithms are SHA256, SHA384, and SHA512.
expression
A valid expression that contains the data values to be counted. expression can be the name of a column or an expression that evaluates to a column of data. You cannot specify expression as a subquery.
Examples
The following example uses the SHA512 algorithm to generate hash values for the contents of the FirstName column in the Sample.Customers table.
SELECT HASHBYTES('SHA512',FirstName) FROM Sample.Customers