Board index » delphi » problem on local SQL, please help

problem on local SQL, please help

How can I get the integer part of numeric value using local SQL on Paradox
tables ?
In other words  I need equivalent of "INT" function in SQL statement...
I have tried FLOOR function , but local SQL does not support it.

I will appreciate any solution.
Marek.

 

Re:problem on local SQL, please help


Quote
On Sun, 6 Jun 1999 10:15:55 -0500, "Marek" <m...@tradition.ca> wrote:
>How can I get the integer part of numeric value using local SQL on Paradox
>tables ?
>In other words  I need equivalent of "INT" function in SQL statement...
>I have tried FLOOR function , but local SQL does not support it.

Local SQL (what the BDE uses for dBASE, Paradox, and FoxPro tables) is a
subset of SQL-92. SQL-92 includes no functions like you describe, and so
neither does the local SQL subset. However, using the SQL function CAST it
is possible to do what you needed.

You can use the CAST function on a floating point numeric value to convert
it to type INTEGER. In so doing, the digits to the right of the decimal
point are lost (the number is truncated, not rounded).

  SELECT CAST(AmountPaid AS INTEGER)
  FROM ":DBDEMOS:Orders"

Local SQL is documented in the online help file LOCALSQL.HLP, found in the
main BDE directory. This help file is a language reference of the local SQL
implementation (subset) of SQL-92. The copy of this file that came with BDE
4.x (and earlier versions) was outdated and has since been rewritten.
Updated copies will have the topic "Unsupported language" in the index (and
lack of this topic indicates a pre-update copy). I can e-mail you a copy of
the updated file if you need and desire it.

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Steve Koterski     "An inventor is a person who makes an ingenious
Felton, CA         arrangement of wheels, levers and springs, and believes
                   it civilization."          -- Ernest Dimnet (1866-1954)

Other Threads