Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between float and [numeric](18, 10)

Tags:

sql-server

what's the differece between a sql server type of:

float and [numeric](18, 10)

like image 510
mrblah Avatar asked Aug 09 '26 05:08

mrblah


1 Answers

FLOAT conforms to IEEE 754 and approximates decimal representation.

NUMERIC is exact in decimal representation (up to the declared precision).

SELECT  CAST(PI() AS FLOAT),
        CAST(PI() AS NUMERIC(20, 18)),
        CAST(PI() AS NUMERIC(5, 3))


---------------------- --------------------------------------- ---------------------------------------
3,14159265358979       3.141592653589793100                    3.142
like image 126
Quassnoi Avatar answered Aug 10 '26 18:08

Quassnoi