Solved

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

Posted on 2013-01-28
4
1,316 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
  • 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Detach & Attach 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.
In this article I will describe the Copy Database Wizard 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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 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