SQL Msg 8115

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
From scanitem
WHERE RepAccountNo = 000000000040870 AND shipmentdate > = (Select getdate()-2)

Thank you,
Who is Participating?
Anthony PerkinsCommented:
Try it this way:
SELECT  WayBillNumber ,
        ShipmentDate ,
        RepAccountNo ,
        RepName ,
        ShippingAddress ,
        City ,
        Province ,
        SpecialNote ,
        PostalCode ,
FROM    scanitem
WHERE   RepAccountNo = '000000000040870'
        AND shipmentdate > = DATEADD(day, -2, GETDATE())

Open in new window

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Make sure the length of the VARCHAR variable and/or column is long enough to hold the decimal or numeric value:
W.E.BAuthor Commented:
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.

W.E.BAuthor Commented:
wow, this did it.
thank you
W.E.BAuthor Commented:
Thank you.
Anthony PerkinsCommented:
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())
AND shipmentdate >= DATEADD(DAY, -2, DATEDIFF(DAY, 0, GETDATE()))
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.