Database Welcome to the Teradata Forums. Read the guidelines on posting. Email notifications and RSS feeds are available, and also a chronological list of all forum activity.
 Print All Forums Database nithinvtm 1 post Joined 03/14 08 Apr 2014 Rounding Number How to Rounding up to the full number. For example I have a duration 1.9585, I want to show it as 2. If I have duration as 4.3505, I want to show it as 5. And I am using Teradata 13, CEIL Function is not supporting in that version :( Adharssh 36 posts Joined 08/13 09 Apr 2014 Hi, `SEL CAST('1.985' as DECIMAL(10,0)`If you try to cast it to Decimal, it will round the value. I am not sure of CEIL function. Thanks & Regards, Adharssh. Share the Knowledge. Feel the Happiness, When you share/Teach it. krishaneesh 140 posts Joined 04/13 09 Apr 2014 The one mentioned by Adarsh will workÂ in the first case but not in the second case.sel cast(4.3505 as decimal(10,0)) gives the result as 4. Any casting you do like this with less than 0.5 will point to the preceding number and greater than that will point to the next number. but if you want to resort to 4+ to point to 5 then you need to use case statment. Qaisar Kiani 337 posts Joined 11/05 10 Apr 2014 ```SEL CASE WHEN COL1 - CAST (COL1 AS DECIMAL(10,0)) = 0 THEN COL1 ELSE CAST(COL1 AS DECIMAL(10,0)) + 1 END```You are right, the CEIL and FLOOR functions are available in TD 14. ToddAWalter 316 posts Joined 10/11 10 Apr 2014 Or the programmer's trick: cast((col1+.5) AS integer) (cast to integer truncates the decimal portion) You must sign in to leave a comment. Active Posters