Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Erro em Consulta

Escrevi uma consulta porem esta dando erro, alguem pode me ajudar?

SELECT

T0.[DocDate],

T0.[SubStr],

T0.[SeriesStr],

T0.[TaxDate],

T0.[CardCode],

T2.[State1],

T2.[State2],

ISNULL((SELECT TOP 1 T1.[CFOPCode] FROM PCH1 T1 WHERE T0.DocEntry = T1.DocEntry),0) AS 'CFOP',

ISNULL((SELECT SUM(PCH4.BaseSum) FROM PCH4 WHERE T0.DocEntry = PCH4.DocEntry AND PCH4.StaType = 15),0) AS 'BASE ICMS',

ISNULL((SELECT TOP 1 PCH4.TaxRate FROM PCH4 WHERE T0.DocEntry = PCH4.DocEntry AND PCH4.StaType = 15),0) AS 'ALIQUOTA ICMS',

ISNULL((SELECT SUM(PCH4.TaxSum) FROM PCH4 WHERE T0.DocEntry = PCH4.DocEntry AND PCH4.StaType = 15),0) AS 'VL. ICMS',

ISNULL((SELECT SUM(PCH4.BaseSum) FROM PCH4 WHERE T0.DocEntry = PCH4.DocEntry AND PCH4.StaType = 14),0) AS 'BASE IPI',

ISNULL((SELECT SUM(PCH4.TaxSum) FROM PCH4 WHERE T0.DocEntry = PCH4.DocEntry AND PCH4.StaType = 14),0) AS 'VL IPI'

FROM OPCH T0

INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode

WHERE

(T0.[DocDate] >= '[%0]' AND T0.[DocDate] <= '[%1]')

o erro é "Conversion failed when converting datetime from character string".

Former Member
Not what you were looking for? View more on this topic or Ask a question