Stored Procedures [dbo].[MssWebUpdateSectionPreference]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inSysUserIdint4
@inSectionKeynvarchar(50)100
@inIsExpandedbit1
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
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
Uses