Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 08 Dec 2006 @ 11:29:40 GMT


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


Subj:   Re: Nth digit in a DECIMAL(10,0)
 
From:   Redekar, Rahul

Hi Prahlad,

Check whether the example given below can help you.

     ct test (col1 dec(10,0));


      *** Table has been created.
      *** Total elapsed time was 1 second.


      BTEQ -- Enter your DBC/SQL request or BTEQ command:
     insert into test values(1159283);


      *** Insert completed. One row added.
      *** Total elapsed time was 1 second.


      BTEQ -- Enter your DBC/SQL request or BTEQ command:
     insert into test values(1155283987);


      *** Insert completed. One row added.
      *** Total elapsed time was 1 second.


      BTEQ -- Enter your DBC/SQL request or BTEQ command:
     insert into test values(152639877);


      *** Insert completed. One row added.
      *** Total elapsed time was 1 second.


      BTEQ -- Enter your DBC/SQL request or BTEQ command:
     sel cast(((cast(col1 as char(4)))mod 10) as char(1)) from test;


      *** Query completed. 3 rows found. One column returned.
      *** Total elapsed time was 1 second.

     (col1 MOD 10)
     -------------
     6
     9
     5

Regards,

Rahul Redekar.



     
  <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