Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 19 Dec 2006 @ 11:42:21 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Char2Hex and Vice-Versa
 
From:   Anomy Anom

<-- Anonymously Posted: Tuesday, December 19, 2006 04:39 -->

Hi All

It would be of great help if you could help me to know how to frame the SQL for Conversion from Hex to Char.

I do know how to convert a string value from Char to hex and vice - versa

     Sel CHAR2HEXINT( TRANSLATE('Test' USING UNICODE_TO_LATIN) )
     -- 54657374

     Sel '54657374'XC
     -- Test

But If I insert the string into a table as a hex how do I get the value back from the table ..

     Create table Hexcon
     (
       Col1 varchar(30)
     )
     ;
     Insert into Hexcon
     Sel CHAR2HEXINT( TRANSLATE('Test' USING UNICODE_TO_LATIN) ) ;
     Sel col1 from Hexcon
     -- 54657374 ;

I need to convert this Hex to its original ASCII value 'Test' how to do this ?...

I am able to do the same using a Stored procedure by reading the value from the table one by one and converting it into ASCII value and inserting into another table. But this is very slow.. Is there any other way thru SQL alone.

Thanks for your help



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023