Solved

Arithmetic overflow error converting expression to data type int

Posted on 2006-06-14
3
555 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
ID: 16905204
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
ID: 16905268
Thanks !
0
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 16906419
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 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

11 Experts available now in Live!

Get 1:1 Help Now