Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 23 Jul 2008 @ 16:17:37 GMT


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


Subj:   Re: How to Achieve the decimal part
 
From:   Michael Larkins

Akula:

Since Teradata stores the date as a number, there is no need for a function to work for character dates. You can simply do the math and divide. The thing to consider is that in Teradata, the data type going into the equation determines the data type coming out in the result. In other words, when you divide using integers, your answer is an integer. So, if you want to see decimal portions at least one of your operands needs to be decimal.

Try something like this:

     (start_date-end_date)/31.00 as integer_months
     ,(start_date-end_date)/30.44 as decimal_months
                 /* as suggested in previous posting */

Hope this helps,

Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor



     
  <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