Round and Show To 2 Decimal Places?

advertisements

This question already has an answer here:

  • SQL - Rounding off to 2 decimal places 10 answers
  • Formatting an SQL numeric query result with an arbitrary number of decimal places 6 answers

I have a small question to ask. How to round a numeric field upto 2 decimal places, and also show it with 2 decimal places only

For example the following would return 255.88000000000

select round(255.87908765444,2)

How to get 255.88 only?

Pleas help.

Thanks,


All you need is:

CAST(255.87908765444 as decimal(18,2)).

When you convert data types in which the target data type has fewer decimal places than the source data type, the value is rounded. From microsoft