SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE VIEW [test_systemvergleich].[Belege_SKR_STK] AS
SELECT T1.Jahr
     , T1.Rechtseinheit_ID
     , T1.Betrieb_ID
     , T1.Acct_Nr
     , T1.Fabrikat
     , T1.Menge AS Menge_Kunde
     , T1.Menge AS Menge_ETL
FROM GC.test.Belege_SKR_STK T1
         FULL OUTER JOIN test.Belege_SKR_STK T2 ON
    T1.Jahr = T1.Jahr AND
    T1.Rechtseinheit_ID = T2.Rechtseinheit_ID AND
    T1.Betrieb_ID = T2.Betrieb_ID AND
    T1.Acct_Nr = T2.Acct_Nr AND
    T1.Fabrikat = T2.Fabrikat
WHERE T1.[Menge] is null
   OR T2.[Menge] is null
   OR round([T1].[Menge] - [T2].[Menge], 2) <> 0.00
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
