SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE VIEW [test].[_GC_Tabellen_Joins] AS
SELECT 'Aftersales_Rechnungen_neu' AS [Tabelle]
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , [Konto_Nr_imr]
     , [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[Aftersales_Rechnungen_neu]

UNION ALL
SELECT 'Zeit_verk_Std'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , [Employee_ID_imr]
FROM [transform].[Zeit_verk_Std]
UNION ALL
SELECT 'LOC_BELEGE_DETAIL'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , [Marke_FIBU_imr]
     , [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[LOC_BELEGE_DETAIL]
UNION ALL
SELECT 'Aftersales_Rechnungen_ben_AW_final'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[Aftersales_Rechnungen_ben_AW_final]
UNION ALL
SELECT 'NW_GW_VK'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[NW_GW_VK]
UNION ALL
SELECT 'Aftersales_Rechnungen_verk_AW_final'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[Aftersales_Rechnungen_verk_AW_final]
UNION ALL
SELECT 'OP_aus_LOC_Belege_ohne_8520'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[OP_aus_LOC_Belege_ohne_8520]
UNION ALL
SELECT 'Zeit_Stempelungen_Pausen'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , [Employee_ID_imr]
FROM [transform].[Zeit_Stempelungen_Pausen]
UNION ALL
SELECT 'offene_Auftraege_Teile'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[offene_Auftraege_Teile]
UNION ALL
SELECT 'Belege_SKR_STK'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , [Marke_FIBU_imr]
     , [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[Belege_SKR_STK]
UNION ALL
SELECT 'NW_GW_Bestand'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , [Standort2_imr]
     , [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[NW_GW_Bestand]
UNION ALL
SELECT 'Zeit_ben_Std_LG'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[Zeit_ben_Std_LG]
UNION ALL
SELECT 'Aftersales_Rechnungen_Focus_Group'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[Aftersales_Rechnungen_Focus_Group]
UNION ALL
SELECT 'Zeit_Abwesenheit_neu'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , [Employee_ID_imr]
FROM [transform].[Zeit_Abwesenheit_neu]
UNION ALL
SELECT 'offene_Auftraege_DG_Anz_Tage'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[offene_Auftraege_DG_Anz_Tage]
UNION ALL
SELECT 'Belege_SKR'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , [Marke_FIBU_imr]
     , [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[Belege_SKR]
UNION ALL
SELECT 'Belege_Bilanz_SKR'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , [Marke_FIBU_imr]
     , [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[Belege_Bilanz_SKR]
UNION ALL
SELECT 'Zeit_Sollzeit'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , [Employee_ID_imr]
FROM [transform].[Zeit_Sollzeit]
UNION ALL
SELECT 'Zeit_Stempelungen_neu'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , [Employee_ID_imr]
FROM [transform].[Zeit_Stempelungen_neu]
UNION ALL
SELECT 'NW_GW_VK_Journal_Accountings'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[NW_GW_VK_Journal_Accountings]
UNION ALL
SELECT 'offene_Auftraege_Ums_ben_AW'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[offene_Auftraege_Ums_ben_AW]
UNION ALL
SELECT 'Umsatz_Belege_SKR'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , [Marke_FIBU_imr]
     , [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[Umsatz_Belege_SKR]
UNION ALL
SELECT 'Zeit_Stempelungen_Pausen_produktiv'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , [Employee_ID_imr]
FROM [transform].[Zeit_Stempelungen_Pausen_produktiv]
UNION ALL
SELECT 'OP_aus_LOC_Belege_Deb_Saldo'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[OP_aus_LOC_Belege_Deb_Saldo]
UNION ALL
SELECT 'OP_aus_LOC_Belege_nur_8520'
     , [Hauptbetrieb_imr]
     , [Standort_imr]
     , NULL AS [Standort2_imr]
     , NULL AS [Fabrikat_imr]
     , NULL AS [Marke_FIBU_imr]
     , NULL AS [Konto_Nr_imr]
     , NULL AS [Produktbuchungsgruppe_imr]
     , NULL AS [Employee_ID_imr]
FROM [transform].[OP_aus_LOC_Belege_nur_8520]
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
