Round() function in SQL Server

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.

31 comments

  1. Pingback: GCLUB
  2. Pingback: Rage quit
  3. Pingback: Togelsumo
  4. Pingback: 바카라사이트
  5. Pingback: 바카라사이트
  6. Pingback: road cases decals
  7. Pingback: botox
  8. Pingback: scam
  9. Pingback: CBD oil
  10. Pingback: Tochka Market
  11. Pingback: cdr qq

Leave a Reply