Re: Changing criteria in queries

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Dear Luther:

Was the overflow caused by cases where POSEN1 + POSEN2 was zero? In cases
where this would be to divide by zero, what result did you want from your
query? Since you are filtering for POSEN1 + POSEN2 >= 100000, It would seem
it doesn't matter. So, I suggest you replace:

AND
((([POSEN1]/([POSEN1]+[POSEN2]))*100)<70) AND
((([POSEN2]/([POSEN1]+[POSEN2]))*100)<70) AND

with

AND
(POSEN1 / IIF(POSEN1 + POSEN2) < 100000, 1, POSEN1 + POSEN2) * 100) < 70 AND
(POSEN2 / IIF(POSEN1 + POSEN2) < 100000, 1, POSEN1 + POSEN2) * 100) < 70
AND

This prevents dividing by zero and may eliminate the overflow.

I don't see where changing the datatypes will help with the overflow
problem.

Tom Ellison


"Luther" <Luther@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:686EDB58-CE50-4A89-8C21-7D9AC874E2FD@xxxxxxxxxxxxxxxx
> Tom,
>
> This is going to be a on-time change; the only reason is the dreaded
> "Overflow error" that I get when I ran these queries. Here is an example
> of
> that caused this:
>
> UPDATE HIPlanNames
> SET POS = "84"
> WHERE (POS Is Null AND INDVTOT=True AND
> POSInd=True AND NonHMO_POS=True AND
> UnknownPOS=False AND POSEN1 Is Not Null AND
> POSEN2 Is Not Null AND
> ((([POSEN1]/([POSEN1]+[POSEN2]))*100)<70) AND
> ((([POSEN2]/([POSEN1]+[POSEN2]))*100)<70) AND
> (([POSEN1]+[POSEN2])>=100000));
>
>
> "Tom Ellison" wrote:
>
>> Dear Luther:
>>
>> I'm going to guess that you want to compare the values as numbers. In
>> other
>> works, this makes the string "1000" to be less than "999", whereas
>> comparing
>> them as strings "9" > "1".
>>
>> You could change the queries to CLNG("1000") < CLNG("999") to compare the
>> integer equivalent.
>>
>> All this begs the serious issue of why you are changing data types. Are
>> you
>> going to be changing them back and forth repeatedly, or is this a
>> one-time
>> change? Will the subsequent column eventually contain letters as well as
>> digits? Is "1000" less than or greater than "A10"?
>>
>> Tom Ellison
>>
>>
>> "Luther" <Luther@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:D7600DAE-35EE-4559-B096-6E9CF799F68D@xxxxxxxxxxxxxxxx
>> > Hello,
>> >
>> > Is there a way to change the criteria values in queries when the data
>> > type
>> > chages also? For example, if I change a field data type from number to
>> > text,
>> > I would also like the criteria value to also change from say <1000 to
>> > <"1000". I have a multitude of these and right now, it's being done
>> > manually.
>> >
>> > Any help would be appreciated.
>>
>>
>>


.



Relevant Pages

  • Re: Flags in CCR register after...
    ... with regards to what flags are set when the commands listed below are ... TSTA command tests register A for zero or minus -> A - $00 ... because a sub of 0 doesn't generate an overflow, ...
    (alt.lang.asm)
  • [PATCH 37/39] move __get_user and __put_user into uaccess.h
    ... * Context: User context only. ... * data types like structures or arrays. ... * Returns zero on success, ...
    (Linux-Kernel)
  • [PATCH 26/39] merge getuser
    ... * Context: User context only. ... * This macro copies a single simple variable from user space to kernel ... * data types like structures or arrays. ... * Returns zero on success, ...
    (Linux-Kernel)
  • Re: Problem with PERF_AVERAGE_TIMER counter type
    ... It should not overflow for like ... Suppose you have a zero value at time zero and zero value at time ... I can easily get 300 servers. ... Ajit wrote: ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Matrix multiplication 3*3
    ... differ in how they handle int 10h/0Eh. ... it does color 7 to video "page" zero. ... Your PRINT_NUMBER routine should... ... nines:) You don't check for overflow, ...
    (comp.lang.asm.x86)