Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sat, 09 Dec 2006 @ 10:59:24 GMT


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


Subj:   Re: Nth digit in a DECIMAL(10,0)
 
From:   Vinay Bagare

Try this.

This will find if the number of digits is greater than 4 and then finds the 4the decimal.

     SEL
     CAST(Col AS VARCHAR(10)) AS Dec_Char
     ,CHARACTER_LENGTH(Dec_Char) AS ChrLen
     ,CASE WHEN ChrLen > 4 THEN SUBSTRING(Dec_Char FROM (Chr_Len - 5) FOR 1
                ELSE 'Number has fewer digits' END DecResult
     FROM Table;

Thanks,

Vinay Bagare



     
  <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