How can we help you today? How can we help you today?

How to create an SQL string from a binary field

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
                Next
                sRes += " "
        End Select
        Return sRes
    End Function
DieterS
0

Comments

1 comment

  • Rob C
    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?
    Rob C
    0

Add comment

Please sign in to leave a comment.