Solved

Arithmetic overflow error converting expression to data type int

Posted on 2006-06-14
3
553 Views
Last Modified: 2008-02-01
I am getting the following error below:

Microsoft OLE DB Provider for SQL Server error '80040e57'
Arithmetic overflow error converting expression to data type int

It is connecting to a MSSQL database using ASP.

strsqlCFG1 = "SELECT TOP 5 tblCustomers.*,tblCustomers.CustID AS CustKey FROM tblCusomers WHERE  tblCustomers.Active='Active' ORDER BY RAND(-(1000*CustID)* " & R & ")"

The error goes away when I remove:
ORDER BY RAND(-(1000*CustID)* " & R & ")"

Any ideas?
0
Comment
Question by:JuniorBee
  • 2
3 Comments
 
LVL 95

Accepted Solution

by:
Lee W, MVP earned 500 total points
Comment Utility
Reduce the 1000 to 100 or 10.  An integer value can be only so large and you're exceeding that.
0
 

Author Comment

by:JuniorBee
Comment Utility
Thanks !
0
 
LVL 95

Expert Comment

by:Lee W, MVP
Comment Utility
Integer data types max out at a little over 2 billion (4 billion possible numbers, 2 billion positive, 2 billion negative).  Make sure whatever you multiply by will NEVER reach that point or you may have this problem randomly again in the future.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now