I am having problem to format digits in my select column.I used FORMAT but it doesn't work. Here is my column:
sum(cast(datediff(second, IEC.CREATE_DATE, IEC.STATUS_DATE) as float) / 60) TotalSentMinutes
I used this:
FORMAT(sum(cast(datediff(second, IEC.CREATE_DATE, IEC.STATUS_DATE) as float) / 60),2) TotalSentMinutes
ERROR:
'format' is not a recognized built-in function name.
How can I format this calculation?
Rounding a decimal number to two decimal places is the same as rounding it to the hundredths place, which is the second place to the right of the decimal point. For example, 2.83620364 can be round to two decimal places as 2.84, and 0.7035 can be round to two decimal places as 0.70.
For bigint use SELECT substr((2.938 % 1)::text,3)::bigint; , else use text result.
SELECT ROUND(-4.535,2); Explanation: The above MySQL statement will round the given number -4.535 up to 2 decimal places.
Try this one -
DECLARE @i FLOAT = 6.677756 SELECT ROUND(@i, 2) , FORMAT(@i, 'N2') , CAST(@i AS DECIMAL(18,2)) , SUBSTRING(PARSENAME(CAST(@i AS VARCHAR(10)), 1), PATINDEX('%.%', CAST(@i AS VARCHAR(10))) - 1, 2) , FLOOR((@i - FLOOR(@i)) * 100)
Output:
---------------------- 6,68 6.68 6.68 67 67
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With