Solved

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

Posted on 2013-01-28
4
1,225 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
Comment Utility
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
Comment Utility
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
Comment Utility
good
0
 
LVL 65

Expert Comment

by:Jim Horn
Comment Utility
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

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

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…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

763 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

7 Experts available now in Live!

Get 1:1 Help Now