Interbase / FIrebird Error on SUM()

Posted on 2010-09-09
Medium Priority
Last Modified: 2012-06-21
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
Question by:mucicid
LVL 38

Expert Comment

by:Geert G
ID: 33634225
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'


select sales
from tkt_tiket
where sdate >= '2009-01-01' and sdate <= '2009-01-31'
order by sales desc
LVL 38

Expert Comment

by:Geert G
ID: 33634231
do you get this same error if you do it from the ib console ?

or just in delphi ?

Author Comment

ID: 33634427
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.
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

LVL 38

Expert Comment

by:Geert G
ID: 33634677
have you checked the values in the db for sales ?

Expert Comment

ID: 33637139
What type is sdate field?
LVL 19

Accepted Solution

Nick Upson earned 1500 total points
ID: 33644446
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

Author Closing Comment

ID: 34016960
thx. sory for too long

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

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

Microsoft Jet database engine errors can crop up out of nowhere to disrupt the working of the Exchange server. Decoding why a particular error occurs goes a long way in determining the right solution for it.
In this article, we will show how to detach and attach a database and then show how to repair a corrupt database and attach it, If it has some errors. We will show how to detach and attach using SSMS or using T-SQL sentences.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

587 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question