• Another option is to use CLR, even though not everyone is a fan of that option. The SQL# library that is available at http://www.SQLsharp.com/ has functions to do this. Since those functions are not available in the free version, I can say that you can accomplish this by using the BinaryReader and BinaryWriter classes and the SqlBytes datatype to map to VARBINARY(MAX).

    SQL#https://SQLsharp.com/ ( SQLCLR library ofover 340 Functions and Procedures)
    Sql Quantum Lifthttps://SqlQuantumLift.com/ ( company )
    Sql Quantum Leaphttps://SqlQuantumLeap.com/ ( blog )
    Info sitesCollations     •     Module Signing     •     SQLCLR