SQL Numbers Rounded Decimals

1

In SQL for giving an example in some fields I get data like "300.38383" for giving an example and I only need the first 2 decimal places after the round point

  

What functions are there so that only the first 2 rounded decimals are thrown

    
asked by JorgeTL25 04.07.2018 в 04:54
source

1 answer

3

To format numbers in sql server, you can use the FORMAT function

  

FORMAT (value, format [ culture])

The function receives the value, and the type of format. For numeric formats, to two decimals, you can use a standard format like 'N', which formats to two decimals automatically.

Format(300.38383,'N')

Return

  

300.38

For reference, there is the documentation here

    
answered by 04.07.2018 в 05:18