spAddUpdate_UserPersonalPages

Parameters

Parameter Parameter Type Mode Description
@PKID int INOUT
@Name nvarchar(100) IN
@ParentID int IN
@FundRaiserPageID int IN
@IsPublished bit IN
@IsHome bit IN

Definition

Copy


                      CREATE PROCEDURE [dbo].[spAddUpdate_UserPersonalPages]
(
    @PKID            int output,
    @Name        nvarchar(100),        
    @ParentID         int,
    @FundRaiserPageID        int,
    @IsPublished    bit,
    @IsHome        bit
)
AS

    begin transaction
    if (@PKID<=0)
        begin

        INSERT INTO dbo.UserPersonalPages
        (
            [Name]    ,
            [ParentID]    ,
            [FundRaiserPageID]    ,
            [IsPublished]    ,
            [IsHome]
        )VALUES(
            @Name,        
            @ParentID,
            @FundRaiserPageID,
            @IsPublished,
            @IsHome
        ) 

        SELECT
            @PKID = @@Identity

    end else begin

        UPDATE dbo.UserPersonalPages SET
            [Name]        =@Name    ,
            [ParentID]    =@ParentID    ,
            [FundRaiserPageID]    =@FundRaiserPageID,
            [IsPublished]    =@IsPublished,
            [IsHome]    =@IsHome

        WHERE ID=@PKID

    end

    commit transaction