|
|
Archives of the TeradataForum
Message Posted: Wed, 23 Jul 2008 @ 16:17:37 GMT
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
| |