Stored Procedures [dbo].[MssWebInsertUpdateScheduledMessage]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inSakariScheduledMessageIDint4
@inSakariConversationFIDint4
@inSakariContactFIDint4
@inTextMessagenvarchar(max)max
@inCreatedAtdatetimeoffset10
@inSentByint4
@inToBeSentAtdatetimeoffset10
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
create procedure [dbo].[MssWebInsertUpdateScheduledMessage]
    @inSakariScheduledMessageID int,
    @inSakariConversationFID int,
    @inSakariContactFID int,
    @inTextMessage nvarchar(max),
    @inCreatedAt datetimeoffset,
    @inSentBy int,
    @inToBeSentAt datetimeoffset
as
    merge SakariScheduledMessage with( Tablock ) as target
        using( select
        @inSakariScheduledMessageID,
        @inSakariConversationFID,
        @inSakariContactFID,
        @inTextMessage,
        @inCreatedAt,
        @inSentBy,
        @inToBeSentAt) as source
        (
        SakariScheduledMessageID,
        SakariConversationFID,
        SakariContactFID,
        TextMessage,
        CreatedAt,
        SentBy,
        ToBeSentAt )
        on(target.SakariScheduledMessageID = source.SakariScheduledMessageID)
        when matched then
            update
                set target.TextMessage = source.TextMessage,
                    target.SentBy = source.SentBy,
                    target.ToBeSentAt = source.ToBeSentAt
        when not matched then
            insert(
                SakariConversationFID,
                SakariContactFID,
                TextMessage,
                CreatedAt,
                SentBy,
                ToBeSentAt )
            values(
                source.SakariConversationFID,
                source.SakariContactFID,
                source.TextMessage,
                source.CreatedAt,
                source.SentBy,
                source.ToBeSentAt);
GO
GRANT EXECUTE ON  [dbo].[MssWebInsertUpdateScheduledMessage] TO [MssExec]
GO
Uses