[dbo].[MssWebInsertSakariContactSysUser]
create procedure [dbo].[MssWebInsertSakariContactSysUser]
@inSysUserId int,
@inOrderId int,
@inContactPriKey int
as
begin
insert into SakariContactSysuserMap
(
SysuserFID,
SakariContactFID,
LastReadAt
)
select
@inSysUserId,
@inContactPriKey,
sysdatetimeoffset()
where not exists
(
select
top 1 1
from
SakariContactSysuserMap
where SysuserFID = @inSysUserId
and SakariContactFID = @inContactPriKey
)
insert into SakariContactOrderMap
(
OrderFID,
SakariContactFID
)
select
@inOrderId,
@inContactPriKey
where not exists
(
select top 1 1
from SakariContactOrderMap
where
OrderFID = @inOrderID and
SakariContactFID = @inContactPriKey
)
end
GO
GRANT EXECUTE ON [dbo].[MssWebInsertSakariContactSysUser] TO [MssExec]
GO