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 :: creating a table sql 
Sql :: xampp mysql version 
Sql :: activate log mariadb 
Sql :: count in sql and diff 
Sql :: join multiple tables sql 
Sql :: mysql get nth highest 
Sql :: how to check table name in current database sql 
Sql :: date in oracle 
Sql :: python uuid sqlalchemy 
Sql :: mysql run sql file 
Sql :: get week day from date in sql 
Sql :: sql server create constraint 
Sql :: oracle select into 
Sql :: get all columns in a table sql 
Sql :: sql precent format 
Sql :: mysql auerries to find the name starting with vowel letter 
Sql :: Write an SQL query to print details of the Workers whose FIRST_NAME ends with ‘a’. 
Sql :: mysql select statement after index 
Sql :: datediff in sql 
Sql :: remove all data from table mysql 
Sql :: sql in 
Sql :: postgres trigger insert into another table 
Sql :: NVL() Functions 
Sql :: all tables and views oracle 
Sql :: count occurrences sql 
Sql :: change permission to database mysql 
Sql :: import data from csv to sql server 
Sql :: having count oracle two columns 
Sql :: sql data types 
Sql :: what is a unique key in sql 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =