Home > front end >  How to round multiple numeric columns to 2 digits in sql?
How to round multiple numeric columns to 2 digits in sql?

Time:11-13

Say if I need to round multiple numbers to 2 digits now, but I don't want to repeat using round(..., 2) or format(...).

Is there any method to set up the float numbers with 2 digits globally?

CodePudding user response:

select cast(float_column as decimal(10,2))
from your_table

CodePudding user response:

Declare the column or variable of type numeric(18, 2)

You can also use with the CONVERT function

select CONVERT(numeric(18, 2) , 5.54722)
  • Related