Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Real Data types not equal to each other when they look the same.

Status
Not open for further replies.

jlbsloan

Programmer
Mar 1, 2001
45
US
When looking at two different SQL tables that have "Incident_Index" fields which are real data type precision 24, a record will appear to have the same values in this field in both tables yet somehow they are not the same. In my foxpro application it will not recognize these as the same number unless I copy the value in the field from one table to the other. The values in one table were actually created by SQL as a primary key and the corresponding values in the other table were written by a Visual Basic application during a data conversion proccess. Does anyone know a simple fix to this problem other than running an update query to copy the values into the other table?

Thanks,
Jerry
 

From SQL BOL:[ul]Real and Float:
Approximate number data types for use with floating point numeric data. Floating point data is approximate; not all values in the data type range can be precisely represented.[/ul]

In other words, though the display of the numbers may look the same, the internal storage may be different.

If you want precise numbers you must use Numeric or Decimal. You can convert Real to Decimal with the Cast or Convert function in SQL Server. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
I know the difference between Real and Float. Why does the SQL query treat the real numbers as the same but foxpro does not. If I do an SQL query for a specific value it appears in both tables.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top