Web Analytics Made Easy - Statcounter
Round():-This function is used to round a numeric field to the number of decimals specified.

Syntax:-

    ROUND ( numeric_expression , length [ ,function ]

numeric_expression :-Expression of the exact numeric or approximate numeric data type category, except for the bit data type.

length:- Optional.Must be an expression of type tinyint, smallint, or int. 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 on the left side of the decimal point, as specified by length.

function:-Function must be tinyint, smallint, or int. When function is omitted or has a value of 0 (default), numeric_expression is rounded. When a value other than 0 is specified, numeric_expression is truncated.

Examples:-

1) Select Round(234.32,-3)
Result:-
0.00

2) Select Round(234.32,-2)
Result:-
200.00

3) Select Round(234.32,-1)
Result:-
230.00

4) select Round(234.32,0)
Result:-
234.00

5) Select Round(234.32,1)
Result:-
234.30

6) Select Round(234.32, 2)
Result:-
234.32

7) Select Round(234.32,3)
Result
234.32

DMCA.com


Discover more from Technology with Vivek Johari

Subscribe to get the latest posts sent to your email.

By vivekjohari

I am currently working as a Senior Database Professional and have around 18 years of experience in database. Degree:- Master Degree in Computer(MCA) Certification course in Data Science & Machine Learning from Indian Institute of Technology (IIT), Delhi Work experience:- Designing of the database. Database Optimization. Writing Complex Stored Procedures,Functions,Triggers etc. Designing and developing SSIS & DTS packages. Designing SQL Reports using SSRS. Database Server Maintenance. Certification:- MCTS: DA-100: Analysing Data with Microsoft Power BI MCTS: DP-300: Administering Relational Databases on Microsoft Azure Microsoft certified Sql DBA in Sql server 2008 (MCTS). Microsoft certified BI professional in Sql server 2008 (MCTS). Oracle certified profession DBA in ORACLE 10g (OCP) certified profession DBA in ORACLE 9i (OCP) My other publication Technical Blog:- Technologies with Vivek Johari Guest Author and Blogger at sqlservercentral.com

31 thought on “Round() function in SQL Server”
  1. … [Trackback]

    […] There you will find 40352 more Info to that Topic: techmixing.com/2014/08/round-function-in-sql-server.html […]

  2. … [Trackback]

    […] Find More Information here on that Topic: techmixing.com/2014/08/round-function-in-sql-server.html […]

  3. … [Trackback]

    […] Here you can find 61127 more Information to that Topic: techmixing.com/2014/08/round-function-in-sql-server.html […]

Leave a Reply

Discover more from Technology with Vivek Johari

Subscribe now to keep reading and get access to the full archive.

Continue reading