• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 778
  • Last Modified:

Interbase / FIrebird Error on SUM()

i got error likethis when im trying to sum an ammount on sales

Arithmetic exception, numeric overflow, or string truncation
Statement: select sum(sales) from tkt_tiket where sdate >= '2009-01-01' and sdate <= '2009-01-31'

Can anybody help for this error
0
mucicid
Asked:
mucicid
1 Solution
 
Geert GOracle dbaCommented:
the number sum(sales) may be too big

possible a very big number got into the system causing the overflow
find it like this:

select max(sales) from tkt_tiket where sdate >= '2009-01-01' and sdate <= '2009-01-31'

or

select sales
from tkt_tiket
where sdate >= '2009-01-01' and sdate <= '2009-01-31'
order by sales desc
0
 
Geert GOracle dbaCommented:
do you get this same error if you do it from the ib console ?

or just in delphi ?
0
 
mucicidAuthor Commented:
i got the error from ib console and sql explorer. im using C# for the app i havent tried on delphi, on C# app it works well.
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
Geert GOracle dbaCommented:
have you checked the values in the db for sales ?
0
 
bjoveCommented:
What type is sdate field?
0
 
Nick UpsonPrincipal Operations EngineerCommented:
Please try this and see if it solves the problem

select sum(sales) from tkt_tiket where sdate >= '2009-01-01' and sdate <= '2009-01-31' and sales is not null
0
 
mucicidAuthor Commented:
thx. sory for too long
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now