![]() |
|
Archives of the TeradataForumMessage Posted: Tue, 07 Sep 2004 @ 14:52:41 GMT
I guess I can read your question two ways: - You're looking to convert a hex value to a hex representation in ASCII:
'12A4'xb = ascii '12A4'
- Or you're looking to convert a hex value to a decimal value:
'07D2'xb = decimal 2003.
Using the 'hashbucket' function, Dieter showed a REALLY simple method for converting hex to a decimal value. Repeating his examples:
SELECT HASHBUCKET('0001'XB (BYTE(4)));
1
SELECT HASHBUCKET('0100'XB (BYTE(4)));
256
SELECT HASHBUCKET('07D3'XB (BYTE(4)));
2003
You can find more in his note: www.teradataforum.com/teradata/20030506_135609.htm If you're talking about converting hex to an ASCII hex representation, then you might try substring with case statements. I found an example that might be of use: I think I remember that Dieter had a better solution (in another thread), but I can't find it.
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||