Solved

SQL Msg 8115

Posted on 2013-06-11
10
374 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
Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

 
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
 

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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