Hashbytes with different values when doing select and save with update

1
SELECT HASHBYTES('MD5','123') 

This select above returns me the following result: 0x202CB962AC59075B964B07152D234B70

But when I do an update to the table using the same hashbytes

UPDATE USUARIOSLOGADOS SET TOKENSESSAO = HASHBYTES('MD5','123') WHERE CODIGOUSUARIO = 1

The value that is saved is this: ,¹b¬Y[–K-#Kp

It was to record the same result as the first example, but that's not how it rolls ... Does anyone know why?

    
asked by anonymous 17.08.2016 / 22:38

1 answer

1

I discovered staff: The problem was that my datatype in the database was varchar . By performing tests I have seen that the correct type that the hashbytes returns is varbinary . I made the change and it worked fine.

    
17.08.2016 / 23:20