• Hi

    If you need to convert this size of binary data I'd either try to do this in a client application (c#/java/c++/...) or consider to use a SQL CLR function.

    Just tried this one and I get a execution duration of approximately 0.5 seconds with an input buffer of 1.5 mb.

    [Microsoft.SqlServer.Server.SqlFunction]

    [return: SqlFacet(MaxSize = -1)]

    public static SqlString fn_clr_varbintohexstring(

    [SqlFacet(MaxSize=-1, IsNullable=false)]

    SqlBytes binin) {

    byte[] buffer = binin.Buffer;

    StringBuilder sb = new StringBuilder(buffer.Length * 2 + 2);

    sb.Append("0x");

    for (int i = 0; i < buffer.Length; i++) {

    byte b = buffer;

    if (b < 0x10) {

    sb.Append("0");

    sb.Append(b.ToString("x"));

    }

    else

    sb.Append(b.ToString("x"));

    }

    return new SqlString(sb.ToString());

    }

    Hope this helps

    Flo