Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 10 Sep 2003 @ 05:35:15 GMT


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


Subj:   Re: Binary Representation of an Integer
 
From:   McCall, Glenn D

Not sure that I understand exactly what you are asking!?!? An integer field is always returned in its internal representation (it is returned as a 4 byte binary value).

Typically a query tool such as bteq or queryman will convert the four byte binary value to a displayable form.

Most tools allow you to export your results to a file in the native format for example in bteq you could use the .export command

For example try

Create table t1 (i1 integer);
Insert into t1 values (1);

.export data file=somefile.dat
select i1 from t1;
.quit

then you can use a hexdump type of utility to see the contents. For example on NCR MP-RAS you could use hd somefile.dat

which gives

0000    04 00 01 00 00 00 0a                               ....... 0007

the integer I inserted into the table is represented by the four bytes 01 00 00 00. The rest is the length of the record (04 00) and a end of record marker (0a - which happens to be a Linefeed character).

-----

Finally if you are using a programming language such as VB, Java, C etc you simply extract the value from the result set into a variable of the appropriate data type - which can always be determined from the result set metadata if you are unsure what data type to use.

For example in Java:

int someValue = rs.getInt (1);


Hope this helps

Glenn McCall



     
  <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