Article View: borland.public.vdbase.data.sql
Article #1438Re: Help with Data Formats - Please
From: charles richards
Date: Tue, 23 Dec 1997 00:00
Date: Tue, 23 Dec 1997 00:00
73 lines
2685 bytes
2685 bytes
Jim Rowley wrote in message <349EFFD6.4818EFA4@sdhumane.org>...
> I am having similar problems just trying to write a simple querry for
>a dBASE database (.dbf) My select statement says:
>SELECT ANNTY_EE + ANNTY_EARN TOT_ANNUITY FROM PAYROLL
>
>When I run this querry, however, Visual dBASE truncates to zero decimals
>in the resulting field TOT_ANNUITY even though the ANNTY_EE and
>ANNTY_EARN fields are numeric fields with 2 decimals.....
>
>How can we get proper querries now that QBE has been cut??????????
>
Jim,
It seems to depend on the DBF driver level setting in the BDE. If the level
is set to 5 then the results are correst. Set the level to 7 and weirdness
abounds. The ? command in the command window displays 2 decimals (as apposed
to 4 with level=5) and the numbers are correct. The BROWSE command does not
show the decimals and is rounding. When the result set is saved to
sqltest2.dbf, the total field is N 1,0 - completely wrong.
Try this code with level set to 5 and then 7. Let us know your results.
** save as sqltest.prg
if .not. file("sqltest.dbf")
CREATE TABLE sqltest (qty NUMERIC(9,2), AMT NUMERIC(9,2) )
endif
use sqltest excl
gene 50
use
select qty, amt, qty*amt total from sqltest
brow
copy to sqltest2 // check out the structure
** end of sqltest.prg
_Results with LEVEL = 5_
? amt
799066.12
? qty
407667.12
? total
325752983829.9744
? amt * qty
325752983829.97
sqltest2.dbf
Field Field Name Type Length Dec
1 QTY NUMERIC 9 2
2 AMT NUMERIC 9 2
3 TOTAL NUMERIC 20 4
_Results with LEVEL = 7_
? amt
407667.12
? qty
799066.12
? total
325752983829.97
? amt*qty
325752983829.97
sqltest2.dbf
Field Field Name Type Length Dec
1 QTY NUMERIC 9 2
2 AMT NUMERIC 9 2
3 TOTAL NUMERIC 1
Charles Richards
Technical Details
Message-ID:
<67ojkq$j2o1@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<01bcd31c$0aace7e0$0ac721cb@electrolley1> <349EFFD6.4818EFA4@sdhumane.org>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ff5a1,19943909b4f4c965 X-Google-Attributes: gidff5a1,public From: "charles richards" <richards@swmed.edu> Subject: Re: Help with Data Formats - Please Date: 1997/12/23 Message-ID: <67ojkq$j2o1@forums.borland.com> X-Deja-AN: 309638277 References: <01bcd31c$0aace7e0$0ac721cb@electrolley1> <349EFFD6.4818EFA4@sdhumane.org> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: None Newsgroups: borland.public.vdbase.data.sql