Solved

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

Posted on 2011-09-16
4
2,978 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

749 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