Liberace
Liberace

Reputation: 81

Foxpro not throwing error on arithmetic overflow

Good day all I have an issue which is occurring when converting a FoxPro table into MSSQL.

What is happening is, a number was entered into the FoxPro table field, which exceeds the expected value. ( In a 10,2 numeric field a large integer was entered) However despite this, FoxPro still allowed the data to be saved and it is being showed in reports. However, when trying to convert said data into MSSQL it causes and error and said value does not get.

I understand that an error is occurring when the number is saved but my question is why is FoxPro allowing this error to go through and even to be displayed when that number is "wrong"

Upvotes: 0

Views: 305

Answers (1)

Alan B
Alan B

Reputation: 4288

It's possible because all languages have quirks, and this is just a Visual FoxPro one. You're assuming it will behave in the same way as a strongly-typed, compiled language like C. This behaviour probably dates right back to dBase days and was kept for compatibility.

If you try to insert a value into a numeric field that exceeds the dimensions the rules are:

  • Truncate decimal places and round the remaining decimal portion of the field.
  • If the value does not fit, store the field contents using scientific notation.
  • If the value still does not fit, replace the field contents with asterisks.

Upvotes: 1

Related Questions