Skip to Content
0

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

Oct 25, 2016 at 01:10 PM

67

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Andres Ramirez Jaramillo Nov 16, 2016 at 11:54 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Bruno Soto Apr 04, 2017 at 07:44 PM
0

Tampoco funciona en SQL

Share
10 |10000 characters needed characters left characters exceeded