Quantcast

OT: SQL Integer Math not working

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

OT: SQL Integer Math not working

Skip Kimpel via use-livecode
Hi all.

I have 3 columns all defined as INT(10) unsigned default 0. I attempt this sql statement:

update service set totalmileage = endmileage - startmileage

I get the error: Error Code: Error Code: 1690. BIGINT UNSIGNED value is out of range in '(`formsgen`.`service`.`endmileage` - `formsgen`.`service`.`startmileage`)'

I used a where clause to elminate possible NULL values, as well as excluding records where startmileage or endmileage <= 0. I cannot get around this. WTH?? This should be really straight forward. I also tried casting both as unsigned but no workie.

Bob S




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OT: SQL Integer Math not working

Skip Kimpel via use-livecode
NVM. The solution was to first set the result column to signed, then cast the start and end mileage to signed. Turns out one of my techs does not get the concept that when a dialog pops up telling him that he cannot have negative mileage, it doesn't occur to him, "... and therefore I've made an error and need to correct it."

Bob S


> On Mar 20, 2017, at 12:42 , Bob Sneidar <[hidden email]> wrote:
>
> Hi all.
>
> I have 3 columns all defined as INT(10) unsigned default 0. I attempt this sql statement:
>
> update service set totalmileage = endmileage - startmileage
>
> I get the error: Error Code: Error Code: 1690. BIGINT UNSIGNED value is out of range in '(`formsgen`.`service`.`endmileage` - `formsgen`.`service`.`startmileage`)'
>
> I used a where clause to elminate possible NULL values, as well as excluding records where startmileage or endmileage <= 0. I cannot get around this. WTH?? This should be really straight forward. I also tried casting both as unsigned but no workie.
>
> Bob S
>
>
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Loading...