?
Solved

The conversion of the varchar value '581123037000' overflowed an int column.

Posted on 2011-09-16
4
Medium Priority
?
3,160 Views
Last Modified: 2012-05-12
Trying to insert data in a temp table in memory for further work. I get the following error. I tried with and without cast and the same error in both cases. Please advice correction.
Error:
Msg 248, Level 16, State 1, Line 3
The conversion of the varchar value '581123037000' overflowed an int column.
The statement has been terminated.
drop table #TempPX
--charts by keyword
Select OCR.medrecactkey, OCR.addrkey, 
ME.MemberId, Cast(LDI.PRVID as bigint) as FacilityID, 
LG.LocationGroupId, HPE.DataCollectEndDate, LDI.POS
INTO #TempPX
FROM odischartresolution OCR
JOIN table1 OA ON OCR.addrkey = OA.addrkey
JOIN table2HPE ON OA.hprptentityid = HPE.hprptentityid
Join table3ME on OCR.MbrEligKey = ME.MemberEligKey
Join table4LDI on OCR.PrvID = LDI.PRVID
Join table5LG on OCR.AddrKey = LG.Addrkey
where 
HPE.KeyWord in (
'ABC27751PI',
'ABC27752PI'')
order by  OCR.medrecactkey desc

Open in new window

0
Comment
Question by:patd1
[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
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
twol earned 2000 total points
ID: 36550171
Why not specifically create the table before running the process

create table #tempPX
(...

)

Then do insert into #tempPX select ...
0
 

Assisted Solution

by:patd1
patd1 earned 0 total points
ID: 36550192
I found the problem. The OCR table has this field as int and LDI has varchar in it. I changed my join on and it works now.
0
 
LVL 7

Expert Comment

by:BusyMama
ID: 36550203
An INT field I believe can only store numbers up to 2,147,483,647.

You will have to change the datatype in the target table to BIGINT.
0
 

Author Closing Comment

by:patd1
ID: 36572266
my mistake.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how the fundamental information of how to create a table.
Suggested Courses

801 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