Solved

SQL Msg 8115

Posted on 2013-06-11
10
362 Views
Last Modified: 2013-06-11
Hello,
can you please help,
I'm getting error

Msg 8115, Level 16, State 8, Line 1
Arithmetic overflow error converting varchar to data type numeric
Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric


Select WayBillNumber, ShipmentDate,RepAccountNo,RepName,ShippingAddress,City
,Province,SpecialNote,PostalCode,CCOrderNo
From scanitem
WHERE RepAccountNo = 000000000040870 AND shipmentdate > = (Select getdate()-2)

Thank you,
0
Comment
Question by:W.E.B
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 21

Expert Comment

by:oleggold
ID: 39238170
0
 
LVL 21

Expert Comment

by:oleggold
ID: 39238172
0
 
LVL 21

Expert Comment

by:oleggold
ID: 39238173
0
 
LVL 21

Expert Comment

by:oleggold
ID: 39238174
0
 
LVL 12

Expert Comment

by:Seaton007
ID: 39238277
Make sure the length of the VARCHAR variable and/or column is long enough to hold the decimal or numeric value:
http://www.sql-server-helper.com/error-messages/msg-8115-numeric-to-varchar.aspx
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:W.E.B
ID: 39238366
I appreciate if someone can show me how,

I understand the concept that i have to increase the length of the field,but I don't seem to be able to put it together.

Thanks,
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 250 total points
ID: 39238721
Try it this way:
SELECT  WayBillNumber ,
        ShipmentDate ,
        RepAccountNo ,
        RepName ,
        ShippingAddress ,
        City ,
        Province ,
        SpecialNote ,
        PostalCode ,
        CCOrderNo
FROM    scanitem
WHERE   RepAccountNo = '000000000040870'
        AND shipmentdate > = DATEADD(day, -2, GETDATE())

Open in new window

0
 

Author Comment

by:W.E.B
ID: 39238742
wow, this did it.
thank you
0
 

Author Closing Comment

by:W.E.B
ID: 39238744
Thank you.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 39238750
If Shipmentdate contains time (as well as a date) then you may want to consider changing the condition from:
AND shipmentdate >= DATEADD(day, -2, GETDATE())
To:
AND shipmentdate >= DATEADD(DAY, -2, DATEDIFF(DAY, 0, GETDATE()))
0

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

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.
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 is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

23 Experts available now in Live!

Get 1:1 Help Now