Stored Procedures [dbo].[MssWebGetOrderUnreadAndScheduledCount]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inOrderIdint4
@inSysUserIdint4
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
create procedure [dbo].[MssWebGetOrderUnreadAndScheduledCount]
    @inOrderId int,
    @inSysUserId int
as
begin
set nocount on
    set nocount on
    select
        UnreadCount = isnull(Sum(Data.UpdateCount),0) ,
        ScheduledCount = isnull(Sum(Data.ScheduledMessageCount),0)
    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
end
GO
GRANT EXECUTE ON  [dbo].[MssWebGetOrderUnreadAndScheduledCount] TO [MssExec]
GO
Uses