Solved

The conversion of the varchar value overflowed an int column overflowed an int column

Posted on 2013-01-28
4
1,381 Views
Last Modified: 2013-02-12
I have a query something like below

select name from school where school_id in (46, 244, 200)

but the query returns the following error

Msg 248, Level 16, State 1, Line 1
The conversion of the varchar value '00000000000000020000000104000000040000011800004008000008' overflowed an int column.


my school_id data type is

varch(64)
0
Comment
Question by:wasabi3689
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 350 total points
ID: 38829082
That's a mighty big honkin' number.

The range of an int is  -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647), which the number above went past by a couple of billion.
 
int, bigint, smallint, and tinyint (Transact-SQL)
http://msdn.microsoft.com/en-us/library/ms187745.aspx

>my school_id data type is varch(64)
The IN clause likely did an implicit conversion to integers, since the numbers do not have varchar delimeters ' ' around them.  Explain for us what you're trying to pull of with the IN.
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 38829107
Let me know if this works...

select name
from school
where school_id like '%46%'
   OR school_id like '%244%'
   OR school_id like '%200%'
0
 

Author Closing Comment

by:wasabi3689
ID: 38879005
good
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 38879908
Thanks for the PAQ, but if you needed any clarifications you could have asked for them, so a B grade is not warranted here.
0

Featured Post

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MYSQL responding very slow 3 49
Comparison query - 4 columns 9 42
Using this function 4 40
online  environment for testing sql queries 5 29
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 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