Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How does sqlserver retain 8 decimal places?
How does sqlserver retain 8 decimal places?
First, the numerator and/or denominator are converted to a type with decimal precision greater than 8. Decimal, numeric and floating point can be used.

Then do division calculation and convert the calculation result into 8 decimal places.

Select convert (decimal (18,8), convert (decimal (18,8), 1)/3).

select convert(decimal( 18,8), 1/convert(decimal( 18,8),3))

Select conversion (decimal (18,8), conversion (floating point, 1)/3)

select CONVERT(decimal( 18,8), 1/convert(float,3))