Solved

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

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

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…
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.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

919 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

14 Experts available now in Live!

Get 1:1 Help Now