SQLTeam.com | Weblogs | Forums

INT datatype default value


#1

The below Query for alter temp table:

Alter Table ##Table add Value_Meter_Absolute int, Value_Each_Absolute int, GUID varchar(36)

And i tried to update the value in the same temp table.

Update ##Table set
Value_Meter_Absolute= Null,
Value_Each_Absolute = 1.123,
GUID = '323E57CB5F1946E79541BF64501E1D8A'

But in table the value rounded, Value_Each_Absolute = 1.12, Why the decimal point changed.

Value_Meter_Absolute Value_Each_Absolute GUID
Null 1.12 323E57CB5F1946E79541BF64501E1D8A


#2

I don't think you would see 1.12 in Value_Each_Absolute. That column is of data type INT, which can hold only integer numbers. So it will store the value 1 even if you set it to 1.123.


#3

You need to use decimal data type and not int.