?
Solved

SQL Msg 8115

Posted on 2013-06-11
10
Medium Priority
?
404 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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 1000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
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…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

750 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