MS SQL Serever 2008 R2 value fro REAL type

AKR's profile image AKR posted 8 years ago in General Permalink

For fields such as real value displayed incorrectly. For example, for the value 0.38, displayed 0.379999995231628!

1 attachment(s):
  • 2016-05-17_162922
AKR's profile image AKR posted 8 years ago Permalink
CREATE TABLE "Meters" (
    "MeterId" INT NOT NULL,
...
    "VoltageLevel" REAL(24) NULL DEFAULT NULL,
...
    PRIMARY KEY ("MeterId")
)
;
kalvaro's profile image kalvaro posted 8 years ago Permalink

REAL (together with FLOAT) belongs to the Approximate Numerics data types so it's possible that the value shown by HeidiSQL is closer to the actual one than the display value shown by Navicat Premium.

I've been playing with other clients and I get 0.38 with Microsoft SQL tools (sqlcmd and Management Studio) and 0.37999999523163 when connecting from PHP.

BTW, I think that column definition should be FLOAT(24) or REAL.

Please login to leave a reply, or register at first.