So if you want to use the Hashbyte function you have to use the right data type.
Copyable Version:
DECLARE @HashThis nvarchar(40)
DECLARE @HashValue nvarchar(42)
DECLARE @HashValue2 varbinary(42)
set @HashThis = 'myteststring'
SELECT HASHBYTES('SHA1', @HashThis) as 'Auto data type'
set @HashValue=HASHBYTES('SHA1', @HashThis)
SELECT @HashValue as 'Varchar data type'
set @HashValue2=HASHBYTES('SHA1', @HashThis)
SELECT @HashValue2 as 'Varchar data type'
No comments:
Post a Comment