How to turn VARBINARY within PeopleSoft into a string? In PeopleSoft there are string messages that are stored in VARBINARY under the hood.
I would like to convert that data into a string so that I can view it in a data query tool.
Is this possible using SQL and perhaps some built-in SQL Server functions?  I would rather not create a special Java program for just this one field.
Ok, I found out how to translate the data.  It is a compressed string stored as VarBinary.  I needed to use the System.IO.Compression.DeflateStream classDeflate
It would be nice to do this all in SQL, but this at least removes the coding roadblock.

... db connection code...
    var query = @"SELECT TOP 10  * FROM PSAPMSGPUBDATA PH WHERE 1=1   AND IBTRANSACTIONID LIKE 'd8d8%'";

    var cmd = new System.Data.SqlClient.SqlCommand(query,conn);

    var dr = cmd.ExecuteReader();

    while (dr.Read())
    {
        dr[5].Dump();
        var stream = dr.GetStream(7);
        var foo = new byte[9000];
        stream.ReadByte();
        stream.ReadByte();
        var output = new System.IO.Compression.DeflateStream(stream, System.IO.Compression.CompressionMode.Decompress);
        var outStream = new MemoryStream();
        var len = (int) stream.Length;
        output.Read(foo,0,9000);
        output.Close();
        var message = System.Text.Encoding.Default.GetString(foo);
        message.Length.Dump();
        message.Dump();
    }