Skip to Content
0
Former Member
Aug 08, 2011 at 03:59 PM

Sales Analysis query error

33 Views

Experts,

I have a client show need the Sales Analysis report in one excel file without having to open up each customer line to export this.

I created the following query, but get the error "Arithmetic overflow error converting expression to data type datetime. 'User-Defined Values' "

SELECT T0.[DocNum], T0.[ObjType], T0.[DocDate], T0.[DocDueDate], T0.[CardCode], T0.[CardName], T0.[DocTotal], T0.[VatSum], (T0.[DocTotal] - T0.[VatSum]) AS 'Total-Tax', T0.[GrosProfit], (T0.[GrosProfit]/(T0.[DocTotal] - T0.[VatSum])*100) AS 'GrossProfit%'
FROM OINV T0
UNION
SELECT T0.[DocNum], T0.[ObjType], T0.[DocDate], T0.[DocDueDate], T0.[CardCode], T0.[CardName], T0.[DocTotal], T0.[VatSum], (T0.[DocTotal] - T0.[VatSum]) AS 'Total-Tax', T0.[GrosProfit], (T0.[GrosProfit]/(T0.[DocTotal] - T0.[VatSum])*100) AS 'GrossProfit%'
FROM ORIN T0
WHERE T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]
ORDER BY T0.[CardCode]

Any help in solving this error will be welcome!

Marli