The syntax graph for HASHBYTES goes:
So SHAxxx is not there and have never been. They might have been in Visual Studio, but Visual Studio is not SQL Server.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
These queries should not return null but they two on several machines where I have run them as a test:
Is there a fix? I have the latest versions from Windows Catalog
Microsoft SQL Server 2016 (SP3-GDR) (KB5046855) - 13.0.6455.2 (X64)
Oct 15 2024 11:23:31
Copyright (c) Microsoft Corporation
Enterprise Edition (64-bit) on Windows 10 Enterprise 10.0 <X64> (Build 22631: ) (Hypervisor)
and SQL 2022 kb5050771 from four days ago.
SELECT HASHBYTES('MD5', CAST('test' AS varbinary(max))); -- Test with MD5 not null
SELECT HASHBYTES('SHA1', CAST('test' AS varbinary(max))); -- Test with SHA1 not null
SELECT HASHBYTES('SHA256', CAST('test' AS varbinary(max))); -- Test with SHA256 null
SELECT HASHBYTES('SHA224', CAST('test' AS varbinary(max))); -- Test with SHA224 null
SELECT HASHBYTES('SHA384', CAST('test' AS varbinary(max))); -- Test with SHA384 null
SELECT HASHBYTES('SHA512', CAST('test' AS varbinary(max))); -- Test with SHA512 null
SELECT HASHBYTES('SHA2_512', CAST('test' AS varbinary(max))); -- Test with SHA2_512 not null
SELECT HASHBYTES('SHA2_256', CAST('test' AS varbinary(max))); -- Test with SHA2_512 not null
The syntax graph for HASHBYTES goes:
So SHAxxx is not there and have never been. They might have been in Visual Studio, but Visual Studio is not SQL Server.