Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cast binary to char
Message
De
25/07/2005 11:58:53
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01035712
Message ID:
01035741
Vues:
18
I am constructing a document number. It has several codes such as '05' of r fiscal year, and 'AB' for type, etc. It also has a two character counter imbedded in it, and it is space constrained (i.e. I am not able to expand the counter to three digits.) There needs to be room for 200 + items in any given set of numbers. Hexadecimal would take care of this, but I am not able to convert back and forth from binary to char. Currently there is a manual method that uses a table of alpha counters (AA, AB, AC, ... ZZ).

Does that help?


>I still don't understand why you're using binary instead of smallint or tinyint.
>
>>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)
>>>
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