Solved

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

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

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 66

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 66

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 eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

'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 …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

729 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