Stored Procedures [dbo].[MssWebGetConversationListByOrder]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inSysUserIdint4
@inOrderIdint4
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
CREATE procedure [dbo].[MssWebGetConversationListByOrder]
    @inSysUserId int,
    @inOrderId int
as
begin
    set nocount on
    select
        AccountId  = SakariAccount.AccountID,
        SakariAccountPriKey = SakariAccount.SakariAccountID,
        ContactName = SakariContact.ContactName,
        ContactPhone = SakariContact.PhoneNumber,
        contactPriKey = SakariContact.SakariContactID,
        UpdateCount = Data.UpdateCount ,
        ScheduledMessageCount = Data.ScheduledMessageCount,
        LastUpdatedAt = SakariContact.LastUpdatedAt
    from UdfGetUnreadAndScheduledMessageCount(@inSysUserId) Data
    inner join SakariContact on Data.ContactID = SakariContact.SakariContactID
    left outer join SakariContactOrderMap on Data.ContactID = SakariContactOrderMap.SakariContactFID
    inner join SakariAccount on SakariContact.SakariAccountFID = SakariAccount.SakariAccountID
    inner join Orders on SakariContactOrderMap.OrderFID = Orders.PriKey
    where SakariContactOrderMap.OrderFID = @inOrderId
    order by LastUpdatedAt desc
end
GO
GRANT EXECUTE ON  [dbo].[MssWebGetConversationListByOrder] TO [MssExec]
GO
Uses