Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Varbinary() Manipulations
Message
From
28/03/2001 09:41:32
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Varbinary() Manipulations
Miscellaneous
Thread ID:
00489405
Message ID:
00489405
Views:
32
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.
Next
Reply
Map
View

Click here to load this message in the networking platform