I know REAL data type is not accurate and normally for currency I should use numeric data type. But, I’m asked to do some stuff and one of the conditions is that the data type is real. When I try to do round((….),2) for example, I get that round function does not exist for this data type. My question is,

# Tag: rounding

## Round to nearest 15 minute interval

I’ve seen this question asked and answered for time that is stored as a date, but I have duration of hours and minutes stored as numeric(4,2). For example 2.12, is 2 hours 12 minutes. I need to round that to the nearest 15 minute interval, doing this (CONVERT([numeric](4,2),round(2.12/(25),(2))*(25))) doesn’t work because it’s base 10 and rounds time incorrectly. Any help

## Is It Possible to Round a Number Smaller Than 1 In SQL While Keeping In Decimal Form

I am not finding the solution to this issue despite looking specifically for it. The below query is me trying to get the last decimal places to appear properly. select CAST(CAST(33 as float)/100 as …

## Need assistance in using round on a current query

I have the following query where would you add ROUND () if you want to limit the rating to 2 decimal places? Answer By adding the round before the avg I got it.

## Oracle how to truncate a decimal to 1 significant digit?

I would like to round decimal numbers down to the first significant digit. Since they will all have a varying number of leading zero decimals, i searched this site and found the following expression. …

## Always round set seconds / minutes /hours to 00 mysql

In my database I have the following date-times: I want to be able to retrieve these records with the hours, minutes or seconds set to their 00 values: For example I want to be able to return records with seconds and milliseconds set to 00: Or return them setting the minutes to zero as well. How can I write a

## How to have exact decimal values without rounding in MySQL

I have this SQL script below: What I expect like result is: 72.39. I don’t want to round the number. if I use the select round(72.396, 2) the result I get is: 72,40 How can I have what I expect without rounding using Mysql? Answer You need to use the truncate function instead of round: To answer the question in

## can you set environmental variable to round numbers in SQL Server query?

I have a bunch of calculations in a SQL Server 2012 query, kind of like: select T1_month ,a.some_value, b.value_to_compare,(select (some_value – value_to_compare)/value_to_compare*100 where …

## Dividing by decimal values – rounding issue

I’m trying to divide two decimal values, in hope they will return the following; 1.132930. However, SQL appears to be rounding the value to 1.132931. The value returned before conversion is 1.1329305135951. The SQL code i’m using is as follows: Answer You can round the value before the cast as following:

## SQL round percent up to nearest .1

I have a columns of percentages and i want them to always round up to the nearest .1 for example .005 –> .1 .11 –> .2 .3256 –>.4 .6797 –>.7 I am trying ceiling and floor, but they …