Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Varbinary() Manipulations
Message
De
28/03/2001 09:41:32
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Varbinary() Manipulations
Divers
Thread ID:
00489405
Message ID:
00489405
Vues:
31
I have a situation where I am trying to translate some VB code using some byte arrays into T-SQL code so I can run the functionality in a SQL stored procedure. I believe I have successfully converted most of the code but I'm stuck at the the point where there is some manipulation of the VB byte arrays and I don't quite see how I can do this in T-SQL ( or even if it's possible ). The relevant VB code is:
Dim KEY_OFFSET As Long
Dim bytKey() As Byte
Dim bytData() As Byte
Dim lNum As Long

'...Set values for the various variables, then:

For lNum = LBound(bytData) To UBound(bytData)
    If lNum Mod 2 Then
        bytData(lNum) = bytData(lNum) Xor (bytKey(lNum) + KEY_OFFSET)
    Else
        bytData(lNum) = bytData(lNum) Xor (bytKey(lNum) - KEY_OFFSET)
    End If
Next lNum
I can ( or at least I think I can ) get most of the entities translated, i.e. the arrays bounds, Mod, and Xor I can translate. I am using T-SQL varbinary() for the equivalent VB byte arrays and the specific problem I am wrestling with is how to "replace" bits ( bytes? ) in the varbinary() variable like is done with the
bytData(lNum) = bytData(lNum) Xor (bytKey(lNum) + KEY_OFFSET)
VB statement.

Is this possible in T-SQL and if so, how?

Thanks,
Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform