• There are two drawbacks to that function:

    1. It is undocumented and therefore unsupported.

    2. As with all scalar functions, it is invoked once per row. That makes it slow.

    There are a number of alternatives in SQL Server 2005, but your best bet is to upgrade to 2008, where the CONVERT function has been extended to perform this conversion natively. See http://blogs.msdn.com/b/sqlprogrammability/archive/2008/10/31/sql-server-2008-new-binary-hex-string-conversion-functionality-can-dramatically-improve-related-query-performance-by-orders-of-magnitude.aspx

    That link also contains a T-SQL scalar function that can be used with SQL Server 2005. Though still slow, it does not rely on undocumented system functions. Peter Larsson posted an interesting approach using XML (http://sqlblog.com/blogs/peter_larsson/archive/2010/01/27/convert-binary-value-to-string-value.aspx):

    -- Prepare value

    DECLARE @bin VARBINARY(MAX)

    SET @bin = 0x5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8

    -- Display the results

    SELECT @bin AS OriginalValue,

    CAST('' AS XML).value('xs:hexBinary(sql:variable("@bin"))', 'VARCHAR(MAX)') AS ConvertedString

    Perhaps the best (and fastest) option in 2005 is to write a CLR function.