Stored Procedures [dbo].[EmailApiMarkSuccess]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inOutgoingEmailQueueIdsIntListmax
@inSentAtdatetimeoffset10
@inCompletedAtdatetimeoffset10
@inRequestTraceIdvarchar(64)64
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
CREATE PROCEDURE [dbo].[EmailApiMarkSuccess]
    @inOutgoingEmailQueueIds IntList readonly,
    @inSentAt datetimeoffset,
    @inCompletedAt datetimeoffset,
    @inRequestTraceId varchar(64)
AS
begin
    set nocount on

        insert into OutgoingEmailSuccess
        (
            OutgoingEmailFID,
            EnqueuedAt,
            SentAt,
            CompletedAt,
            RequestTraceId
        )
        select
            OutgoingEmail.OutgoingEmailID,
            OutgoingEmailQueue.EnqueuedAt,
            @inSentAt,
            @inCompletedAt,
            @inRequestTraceId
        from @inOutgoingEmailQueueIds EmailQueueIds
        inner join OutgoingEmailQueue on EmailQueueIds.Item = OutgoingEmailQueue.OutgoingEmailQueueID
        inner join OutgoingEmail on OutgoingEmailQueue.OutgoingEmailFID = OutgoingEmail.OutgoingEmailID
        order by EmailQueueIds.Item asc

        exec SyncOutgoingEmailStatus
            @inOutgoingEmailQueueIds = @inOutgoingEmailQueueIds,
            @inActivityTimeStamp = @inCompletedAt,
            @inSucceeded = 1

        delete OutgoingEmailQueue
        from @inOutgoingEmailQueueIds EmailQueueIds
        inner join OutgoingEmailQueue on EmailQueueIds.Item = OutgoingEmailQueue.OutgoingEmailQueueID

end
GO
GRANT EXECUTE ON  [dbo].[EmailApiMarkSuccess] TO [MssExec]
GO
Uses