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

    MERGE INTO [GC_CONFIG].[ari].[Umsatzart]
        AS
        [dest]
    USING
        [GC_ETL_ARI].[transform_config].[Umsatzart]
            AS
            [source]
    ON
        [dest].[Client_DB] = [source].[Client_DB]
            AND [dest].[Gen_ Bus_ Posting Group] = [source].[Gen_ Bus_ Posting Group]

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

    WHEN
        NOT
        MATCHED
        THEN
        INSERT
        ( [Client_DB]
        , [Gen_ Bus_ Posting Group]
        , [Description]
        , [Erstellungsdatum]
        , [Umsatzart]
        , [Zuordnung])
        VALUES ( [source].[Client_DB]
               , [source].[Gen_ Bus_ Posting Group]
               , [source].[Description]
               , [source].[Erstellungsdatum]
               , [source].[Umsatzart]
               , [source].[Zuordnung]);

END
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
