In SQL Server, you can use the CRYPT_GEN_RANDOM()
function to return a cryptographic, randomly-generated number. The number is generated by the Cryptographic Application Programming Interface (CAPI).
CAPI is a Microsoft Windows platform specific application programming interface included with Microsoft Windows operating systems that provides services to enable developers to secure Windows-based applications using cryptography.
The CRYPT_GEN_RANDOM()
function accepts two arguments: the length (required), and a seed (optional).
The return value is varbinary(8000).