views:

60

answers:

2

Is there a way to generate MD5 Hash string of type varchar(32) without using fn_varbintohexstr

SUBSTRING(master.dbo.fn_varbintohexstr(HashBytes('MD5', '[email protected]')), 3, 32)

So it could be used inside a view with SCHEMABINDING

+1  A: 
CONVERT(VARCHAR(32), HashBytes('MD5', '[email protected]'), 2)
Koistya Navin
It doesn't give correct answer in sql-server-2005
Michal Dymel
+2  A: 

Use HashBytes

SELECT HashBytes('MD5', '[email protected]')

That will give you 0xF53BD08920E5D25809DF2563EF9C52B6

-

SELECT CONVERT(NVARCHAR(32),HashBytes('MD5', '[email protected]'),2)

That will give you F53BD08920E5D25809DF2563EF9C52B6

SQLMenace