samedi 23 juillet 2016

Varchar and varbinary error hashbyte

I need to write the following in dynamic sql

select HASHBYTES('SHA2_256',CONVERT(VARCHAR(256),'String'))

set @sqlstr = 'select ' + HASHBYTES('''SHA2_256''',(CONVERT(VARCHAR 
(256),'String')))   

But I got error the following error message:

Msg 402, Level 16, State 1, Line 6 The data types varchar and varbinary are incompatible in the add operator.

How will I solve it?

Aucun commentaire:

Enregistrer un commentaire