	--VendorSettingsTypes
	DECLARE @VendorSettingsTypes TABLE (RowId uniqueidentifier NOT NULL,[Name] [nvarchar](500) NOT NULL,SettingsType int NOT NULL);

    INSERT into @VendorSettingsTypes (RowId, [Name], SettingsType) VALUES ('ac8593f7-87b9-41ad-b15b-f00ba6e9508e', N'MFATrustPeriodInDays',3);
    INSERT into @VendorSettingsTypes (RowId, [Name], SettingsType) VALUES ('53B794F2-F3AE-4F28-8D74-B423B8077122', N'MFALoginBlockAfterFailedRetriesInMinutes',3);

    MERGE INTO dbo.[VendorSettingsTypes] AS TARGET  
		USING @VendorSettingsTypes AS SOURCE  
		ON TARGET.RowId = SOURCE.RowId	
		WHEN MATCHED THEN    
			UPDATE SET	[Name] = SOURCE.[Name],
						[SettingsType] = SOURCE.[SettingsType]
		WHEN NOT MATCHED BY TARGET THEN   
			INSERT (RowId, [Name], SettingsType) VALUES (SOURCE.RowId, SOURCE.[Name], SOURCE.SettingsType)  
	OUTPUT $action, SOURCE.*;

	--VendorSettings
	DECLARE @VendorSettings TABLE (VendorId int NOT NULL, SettingTypeId int NOT NULL, Value nvarchar(1024) NULL);

	--Get the settings DB Id
	declare @MFATrustInDaysId int
	select @MFATrustInDaysId = Id from VendorSettingsTypes where RowId='ac8593f7-87b9-41ad-b15b-f00ba6e9508e'
	--Add to ALL vendors
	INSERT into @VendorSettings select VendorTbl.VendorId,@MFATrustInDaysId,'14' from VendorTbl order by VendorId

    declare @MFALoginBlockAfterFailedRetriesInMinutes int
    select @MFALoginBlockAfterFailedRetriesInMinutes = Id from VendorSettingsTypes where RowId='53B794F2-F3AE-4F28-8D74-B423B8077122'
    --Add to ALL vendors
    INSERT into @VendorSettings select VendorTbl.VendorId,@MFALoginBlockAfterFailedRetriesInMinutes,'15' from VendorTbl order by VendorId

        MERGE INTO dbo.[VendorSettings] AS TARGET  
		USING @VendorSettings AS SOURCE  
		ON TARGET.VendorId = SOURCE.VendorId and TARGET.SettingTypeId = SOURCE.SettingTypeId	
		WHEN MATCHED THEN    
			UPDATE SET	[Value] = SOURCE.[Value],
						[UpdatedUtc] = GetUtcDate()
		WHEN NOT MATCHED BY TARGET THEN   
			INSERT (VendorId, SettingTypeId, [Value],CreatedUtc,UpdatedUtc) VALUES (SOURCE.VendorId, SOURCE.SettingTypeId, SOURCE.[Value],GetUtcDate(),GetUtcDate())  
	OUTPUT $action, SOURCE.*;

	 