Replacement for sys.fn_varbintohexstr

If you are on SQL Server 2005, probably just continue to use it.

If you are on a newer version of SQL Server you can use CONVERT(VARCHAR(MAX), [binarydata], 1) e.g.

SELECT
 sys.fn_varbintohexstr([sid]) AS old_way
,CONVERT(VARCHAR(MAX), [sid], 1) AS new_way
FROM master.sys.sql_logins;

Leave a Reply