Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cast binary to char
Message
De
25/07/2005 11:46:46
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01035712
Message ID:
01035735
Vues:
10
I need the right 2 characters from the data 00 - ff. I do not know how to get that from the number. It is being used as a counting mechanism. I have 200 + items that need to be counted in a two char space. This is the way I thought would work the best. Otherwise I will need to make a table with a list in it and use that. (unless a better suggestion is made).

>Would converting to a number work for you?
SELECT CAST(@hex AS int)
>
>>I am trying to capture the criticle digits of a banary data type (0x1a). I have tryied casting it to a type of char, but it does not work. For example
>>
>>DECLARE @hex binary(1),
>> @char varchar(10)
>>
>>SET @hex = 0x22
>>print @hex
>>SET @char = convert(varchar(10), @hex)
>>print @char
>>SET @hex = @hex + 2
>>print @hex
>>SET @hex = @hex + 9
>>print @hex
>>
>>gives the result:
>>
>>0x22
>>"
>>0x24
>>0x2D
>>
>>
>>Any ideas??
Thank You

Rollin Burr

Politicians and diapers have one thing in common. They should both be changed regularly, and for the same reason.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform