Stored Procedures [dbo].[GetExistingConversations]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inSysUserPriKeyint4
@inOrderPriKeyint4
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
create procedure [dbo].[GetExistingConversations]
    @inSysUserPriKey int,
    @inOrderPriKey int
as
begin
set nocount on;
    select
        Name = SakariContact.ContactName,
        Phone = SakariContact.PhoneNumber,
        ContactPriKey = SakariContact.SakariContactID,
        UserIsSubscribedToContact = convert(bit, isnull(SakariContactSysUserMap.Subscribed,0))
    from SakariContactOrderMap
    inner join SakariContact on
    SakariContact.SakariContactID = SakariContactOrderMap.SakariContactFID
    left outer join SakariContactSysuserMap on
        SakariContact.SakariContactID = SakariContactSysuserMap.SakariContactFID and
        SakariContactSysuserMap.SysUserFID = @inSysUserPriKey and
        SakariContactSysuserMap.Subscribed = 1
    where dbo.SakariContactOrderMap.OrderFID = @inOrderPriKey
end
GO
GRANT EXECUTE ON  [dbo].[GetExistingConversations] TO [MssExec]
GO
Uses