DECLARE @ResourceLocalizedValues TABLE (
    [LanguageId]     INT            NOT NULL,
    [EntityType]     INT            NOT NULL,
    [ResourceKey]    NVARCHAR (200) NOT NULL,
    [LocalizedValue] NVARCHAR (MAX) NOT NULL,
    [Description]    NVARCHAR (200) NULL
)

INSERT @ResourceLocalizedValues([LanguageId], [EntityType], [ResourceKey], [LocalizedValue]) VALUES (1, 7, N'E_ALERT_TYPE_COMMUNICATION_CHANNEL_FAULT',N'{0} connection is down for {2} minutes')
INSERT @ResourceLocalizedValues([LanguageId], [EntityType], [ResourceKey], [LocalizedValue]) VALUES (1, 8, N'E_ALERT_TYPE_COMMUNICATION_CHANNEL_FAULT',N'{0} connection is down for {2} minutes')
INSERT @ResourceLocalizedValues([LanguageId], [EntityType], [ResourceKey], [LocalizedValue]) VALUES (1, 13, N'E_ALERT_TYPE_COMMUNICATION_CHANNEL_FAULT',N'{2} connection is down for {4} minutes')

INSERT @ResourceLocalizedValues([LanguageId], [EntityType], [ResourceKey], [LocalizedValue]) VALUES (1, 7, N'E_ALERT_TYPE_COMMUNICATION_CHANNEL_FAULT_RESTORE',N'{0} connection has been restored')
INSERT @ResourceLocalizedValues([LanguageId], [EntityType], [ResourceKey], [LocalizedValue]) VALUES (1, 8, N'E_ALERT_TYPE_COMMUNICATION_CHANNEL_FAULT_RESTORE',N'{0} connection has been restored')
INSERT @ResourceLocalizedValues([LanguageId], [EntityType], [ResourceKey], [LocalizedValue]) VALUES (1, 13, N'E_ALERT_TYPE_COMMUNICATION_CHANNEL_FAULT_RESTORE',N'{2} connection has been restored')


MERGE INTO [dbo].[ResourceLocalizedValues] AS TARGET  
USING @ResourceLocalizedValues AS SOURCE  
ON TARGET.[LanguageId] = SOURCE.[LanguageId]
	AND TARGET.[EntityType] = SOURCE.[EntityType]
	AND TARGET.[ResourceKey] = SOURCE.[ResourceKey]
WHEN NOT MATCHED BY TARGET THEN
INSERT ([LanguageId], [EntityType], [ResourceKey], [LocalizedValue])
VALUES (SOURCE.[LanguageId], SOURCE.[EntityType], SOURCE.[ResourceKey], SOURCE.[LocalizedValue])
WHEN MATCHED THEN    
UPDATE SET	TARGET.[LocalizedValue] = SOURCE.[LocalizedValue]
OUTPUT $ACTION, SOURCE.*;
