My table testuidpwd
have:
User:
Uid Password Passwordhash
----------------------------------------
121 wrwrwr 0x0013531FA845AEA1E840BDE787336ED3CAEDFE6E
122 etetxw 0x79BAEFD23C2F4D146F9BD2FDF6C14CA25AC5D6AA
uid
char
data typepassword
nvarchar(100)
data typepasswordhash
nvarchar(100)
data type
My problem is when I use function hashbytes('SHA1',password)
update testdb.dbo.testuidpwd
set pwdhash = HashBytes('SHA1', password)
in the column pwdhash
is the nvarchar(100)
data type.
When I execute the below statement
update testdb.dbo.testuidpwd
set pwdhash=HashBytes('SHA1', password)
I got the pwdhash
column as 硽贕ڷד瘃快ﭙ寱캏엞 this kind of format
but I want to store the varbinary
format......in the pwdhash
column
For ex:
update testdb.dbo.testuidpwd
set pwdhash = cast(hashbytes('SHA1', PWD) AS varbinary)
this statement also doesn't work