
[dbo].[MssWebUpdateSectionPreference]
CREATE PROCEDURE [dbo].[MssWebUpdateSectionPreference]
@inSysUserId int,
@inSectionKey nvarchar(50),
@inIsExpanded bit
AS
begin
set nocount on
merge [MssWebSectionPreference] with (tablock) as target
using (
select
@inSysUserId as SysUserId,
MssWebSectionId = MssWebSection.MssWebSectionId
from MssWebSection where MssWebSection.SectionKey = @inSectionKey
) as Source
on target.[SysUserFID] = Source.SysUserId
and target.[MssWebSectionFid] = Source.MssWebSectionId
when matched then
update set
IsExpanded = @inIsExpanded
when not matched then
insert ([SysUserFID], [MssWebSectionFid], [IsExpanded])
values (Source.SysUserId, Source.MssWebSectionId, @inIsExpanded);
end
GO
GRANT EXECUTE ON [dbo].[MssWebUpdateSectionPreference] TO [MssExec]
GO