|
|
Archives of the TeradataForum
Message Posted: Tue, 17 Jan 2012 @ 23:09:20 GMT
Subj: | | Re: How to CAST a number without getting a decimal point. |
|
From: | | Mankala, Mahesh |
Numeric to Numeric Conversion
SELECT CAST (50500.75 AS INTEGER);
Result: 50500 (truncated),
SELECT CAST (50500.75 AS DEC (6,0));
Result: 50501. (rounded).
When you cast from a decimal to an integer, the system discards everything to the right of the decimal point. In our example, even though
the decimal portion was .75, making the number closer to 50501 than to 50500, the result of the cast is still 50500.
Thanks,
Mahesh
| |