Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Numeric Rounding?
Message
From
23/09/2003 19:24:31
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00831676
Message ID:
00831685
Views:
18
>I seem to get different results and conflicts re: decimaled numbers.
>
>Example: In SQL Server2K I have a record in a table with a field value of 388468.031 (DataType REAL) However, when I try to do a insert into that table with a PK value of 388468.024 I get an update conflict/Dup PK. Is there a setting to control rounding of decimal values? .024 and .031 are two differnt numbers.

I have no real-World experience with C/S, really, but it doesn't seem a good idea to use a real number as a primary key, precisely because at some moment, it is doubtful whether two numbers are equal or not.

Perhaps your database server is storing the numbers as real numbers of the 4-byte type; that would give about 6 significant digits. In this case, for all practical purposes, the numbers are the same.

I suggest you consider integer or character as PK.

SQL Server has an option for auto-incremental fields; that would be some sort of integer, but I don't know the exact name in SQL Server.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform