Search
 
SCRIPT & CODE EXAMPLE
 

SQL

round in sql server

SELECT ROUND(125.315, 2);
--Result: 125.320    (result is rounded because 3rd parameter is omitted)
SELECT ROUND(125.315, 2, 0);
--Result: 125.320    (result is rounded because 3rd parameter is 0)
SELECT ROUND(125.315, 2, 1);
--Result: 125.310    (result is truncated because 3rd parameter is non-zero)
SELECT ROUND(125.315, 1);
--Result: 125.300    (result is rounded because 3rd parameter is omitted)
SELECT ROUND(125.315, 0);
--Result: 125.000    (result is rounded because 3rd parameter is omitted)
SELECT ROUND(125.315, -1);
--Result: 130.000    (result is rounded because 3rd parameter is omitted)
SELECT ROUND(125.315, -2);
--Result: 100.000    (result is rounded because 3rd parameter is omitted)
SELECT ROUND(2.5,0) 
-- Result 3
SELECT ROUND(2.4,0) 
-- Result 4
Comment

round .5 to 1 in sql server

SELECT ROUND(2.5,0) -- Result: 3
SELECT ROUND(2.4,0) -- Result: 2
Comment

PREVIOUS NEXT
Code Example
Sql :: select where mysql 
Sql :: what is truncate in sql 
Sql :: sql store procedure 
Sql :: querry mysql by 2 columns 
Sql :: date datatype in livesql 
Sql :: no suitable driver found for sqlite 
Sql :: sqlcmd no headers 
Sql :: compress sql file database ubuntu 
Sql :: sql query order 
Sql :: sql contains vs like 
Sql :: create table kusto 
Sql :: full-text index mysql 
Sql :: how to login to mysql as normal user in ubuntu 
Sql :: convert sql server guid to varbinary 
Sql :: make selected text uppercase mssql 
Sql :: psql initialization 
Sql :: compound trigger oracle 
Sql :: SQL Server date literal 
Sql :: syntax error at or near "AUTO_INCREMENT" 
Sql :: learn sql 
Sql :: grab part of a string sql 
Sql :: rename view mysql 
Sql :: foreign key sql 
Sql :: create user in mysql 
Sql :: inspecting a column unique/distinct values in SQL 
Sql :: cannot connect to mysql server 10060 
Sql :: sql update subtract value 
Sql :: how to add amount between date in sql 
Sql :: join sql 
Sql :: oracle multiple insert 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =