-4
How can I round this number: 3084.08 to: 3084.09 in sql server?
-4
How can I round this number: 3084.08 to: 3084.09 in sql server?
4
You can use the CAST command, example
select CAST(3084.087522295 as numeric (36,2))
3
Use the function ROUND together with CAST of SQL Server:
SELECT CAST(ROUND(3084.087522295, 2) AS NUMERIC(15, 2)) as X
Resulting in 3084.09.
Returns a rounded numerical value for the specified length or accuracy.
Syntax
ROUND ( numeric_expression , length [ ,function ] )Arguments
numeric_expression
Is a Expression of the type category of accurate or approximate numerical data, with the exception of the data type
bit.length
It is the precision for which numeric_expression must be rounded. length must be an expression of type
tinyint,smallintorint. When length is a positive number, numeric_expression is rounded to the number of decimal positions specified by length. When length is a negative number, numeric_expression is rounded to the left of the decimal point as specified by length.Function
This is the type of operation to be executed. Function must be
tinyint,smallintorint. When Function is omitted or has a value equal to 0 (default), numeric_expression is rounded. When a value other than 0 is specified, numeric_expression is truncated.
These functions convert an expression of one data type into another.
cast already rounds, but good ;)
@Lucasmiranda truth, I tested now here and really round
0
There is the ROUND function, round to the number of decimal places.
SELECT ROUND(23542351.4154161,2)
SELECT convert(int,(ROUND(23542351.4154161,0)))
-1
In Mysql SELECT ROUND(3084.087522295, 2);
Exit 3084,09
Browser other questions tagged sql database sql-server
You are not signed in. Login or sign up in order to post.
Is that round? the lower value is more than two decimal places?
– Leonardo Barros
There’s no way I can round up the value after the comma?
– Felipe Michael da Fonseca
The amount coming from the bank is this one: 3084.087522295
– Felipe Michael da Fonseca