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

    MERGE INTO [GC_CONFIG].[ari].[AH_Gruppe]
        AS
        [dest]
    USING
        [GC_ETL_ARI].[transform_config].[AH_Gruppe]
            AS
            [source]
    ON
        [dest].[Gruppe_ID] = [source].[Gruppe_ID]

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

    WHEN
        NOT
        MATCHED
        THEN
        INSERT
        ( [Gruppe_ID]
        , [Gruppe_Name])
        VALUES ( [source].[Gruppe_ID]
               , [source].[Gruppe_Name]);

END
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
