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

    MERGE INTO [GC_CONFIG].[ari].[Kostenstelle]
        AS
        [dest]
    USING
        [GC_ETL_ARI].[transform_config].[Kostenstelle]
            AS
            [source]
    ON
        [dest].[KST-Nr] = [source].[KST-Nr]

    WHEN
        MATCHED
        THEN
        UPDATE
        SET [dest].[KST-Nr] = [source].[KST-Nr]

    WHEN
        NOT
        MATCHED
        THEN
        INSERT
        ( [KST-Nr]
        , [Kostenstelle]
        , [Erstellungsdatum])
        VALUES ( [source].[KST-Nr]
               , [source].[Kostenstelle]
               , [source].[Erstellungsdatum]);

END
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
