SQLTeam.com | Weblogs | Forums

Strange issue with read datatype field numbers from 100000 onwards


#1

I have a table sequence field real data type.

we save sequencenumber.two digits year like 99999.17
now right after 99999.17, when we pass 100000.17 , it is getting saved in table as 100000.2

Is there any issue with real data type. we are passing numbers

100000.17 > becoming 100000.2 in table
100001.17 > becoming 100001.2 in table

kindly need help, trying to run manual update query to set the value to 100000.17, still going back to 100000.2

sql server 2008 R2 on windows 2008 server

Thanks a lot for the helpful info.


#2

What is the actual data type of the column on the table?
Also, when you say "sequence", are you referring to a SQL Server Sequence object? or just using the generic term used to describe a sequential set of numbers?


#3

sequenceno is the name of the column.

seems like real data type has this issue, just tested created a sample table with a column real data type in it tried to push 100000.17, it changed immedeatly to 100000.2

now altered the same column to decimal (10,2) and the value in table reversed from 100000.2 to 100000.17

seems like real data type itself has issue.

Thank you.


#4

I’ve fixed problems like that in the past by using decimal(38,2). (This may create storage issues of course if you have very large tables.)