Is there a way to generate MD5 Hash string of type varchar(32) without using fn_varbintohexstr
SUBSTRING(master.dbo.fn_varbintohexstr(HashBytes(\'MD5\', \'em
You didn't explicitly say you wanted the string to be hex; if you are open to the more space efficient base 64 string encoding, and you are using SQL Server 2016 or later, here's an alternative:
select SubString(h, 1, 32) from OpenJson(
(select HashBytes('MD5', 'email@dot.com') h for json path)
) with (h nvarchar(max));
This produces:
9TvQiSDl0lgJ3yVj75xStg==