Skip to Content

Consulta SQL no funciona en SAP Business One pero si en SQL Server

Hola a todos, tengo una consulta SQL que funciona en SQL Server pero no en SAP Business One 9.2 Query Manager. Que hago para hacer que funcione en SAP ?

(Porfavor probad en SAP B1 9.2 query manager antes de responder)

IF OBJECT_ID ('turnover_view1', 'V') IS NOT NULL DROP VIEW turnover_view1 ; GO CREATE VIEW turnover_view1 AS SELECT T0.CardName , Sum(T0.Doctotal) As Total_factures FROM OINV T0 WHERE ( CONVERT(VARCHAR(10), T0.TaxDate, 120) ) BETWEEN (DATEADD(DAY, 1, EOMONTH(GETDATE(), -1)) ) AND (EOMONTH ( GETDATE() )) AND T0.CANCELED = 'N' GROUP BY T0.CardName ; GO IF OBJECT_ID ('turnover_view2', 'V') IS NOT NULL DROP VIEW turnover_view2 ; GO CREATE VIEW turnover_view2 AS SELECT T0.CardName , Sum(T0.Doctotal) As Total_avoirs FROM ORIN T0 WHERE ( CONVERT(VARCHAR(10), T0.TaxDate, 120) ) BETWEEN (DATEADD(DAY, 1, EOMONTH(GETDATE(), -1)) ) AND (EOMONTH ( GETDATE() )) AND T0.CANCELED = 'N' GROUP BY T0.CardName ; GO SELECT T1.cardname as "Nom du client", T1.Total_factures - ISNULL(T2.Total_avoirs,0) as "Chiffre d'affaires" FROM turnover_view1 T1 LEFT OUTER JOIN turnover_view2 T2 ON T1.CardName = T2.CardName WHERE (T1.Total_factures - ISNULL(T2.Total_avoirs,0) ) <= 5000

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 16, 2016 at 11:54 PM

    Hola

    Prueba borrando la definicion de la vista (IF OBJECT_ID ('turnover_view1', 'V') IS NOT NULL DROP VIEW turnover_view1 ; GO CREATE VIEW turnover_view1 AS)

    guarda la consulta desde el query manager

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 04, 2017 at 07:44 PM

    Tampoco funciona en SQL

    Add comment
    10|10000 characters needed characters exceeded