SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE PROCEDURE [batch].[Update_AH_Hauptbetrieb]
AS
BEGIN

    MERGE INTO [GC_CONFIG].[ari].[AH_Hauptbetrieb]
        AS
        [dest]
    USING
        [GC_ETL_ARI].[transform_config].[AH_Hauptbetrieb]
            AS
            [source]
    ON
        [dest].[Hauptbetrieb_ID] = [source].[Hauptbetrieb_ID]

    WHEN
        MATCHED
        THEN
        UPDATE
        SET [dest].[Hauptbetrieb_ID] = [source].[Hauptbetrieb_ID]

    WHEN
        NOT
        MATCHED
        THEN
        INSERT
        ( [Hauptbetrieb_ID]
        , [Hauptbetrieb_Name])
        VALUES ( [source].[Hauptbetrieb_ID]
               , [source].[Hauptbetrieb_Name]);

END
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
