How to create an SQL string from a binary field

DieterSDieterS Posts: 4
edited December 22, 2016 4:47AM in SQL Comparison SDK 11
I want to create an SQL string that evaluates a binary field.
But I get the wrong data
This is probably because I use the wrong technique for reading the binary data.
The current function looks like this:
   Private Function GetSQLValue(  sValue As RedGate.SQLDataCompare.Engine.FieldPair, 
 	                                      row As RedGate.SQLDataCompare.Engine.ResultsStore.Row
 	                                   ) As String
        Dim field1 As Int32 = sValue.OrdinalInResults1
        Dim sRes As String = ""

        Select Case Val(sValue.Type1)
            Case 14 'binary
                Dim blob1 As Blob = CType(row.Values(field1), Blob)
                Dim I As Int32
                For I = 0 To blob1.Length - 1
                    sRes += blob1.ByteArray(I).ToString
                sRes += " "
        End Select
        Return sRes
    End Function


  • Hi Dieter,

    When you say that you're getting the wrong data, could you provide an example of the data that you are trying to evaluate and the actual output from your function when you pass this data through it?
    Software Engineer
    Redgate Software
Sign In or Register to comment.