spAddUpdate_ChapterRoles

Parameters

Parameter Parameter Type Mode Description
@PKID int INOUT
@ClientRolesID int IN
@ChapterID int IN
@Type int IN

Definition

Copy


        CREATE proc dbo.spAddUpdate_ChapterRoles
        @PKID [int] output,
        @ClientRolesID [int],
        @ChapterID [int],
        @Type [int]

        as

        if  @PKID <= 0
            BEGIN
                INSERT INTO [dbo].[ChapterRoles]([ChapterID], [ClientRolesID],[Type])
                VALUES(@ChapterID, @ClientRolesID, @Type)

                SELECT
                    @PKID = @@Identity
            END

        else
            BEGIN
                UPDATE [dbo].[ChapterRoles]
                SET [ChapterID]=@ChapterID, [ClientRolesID]=@ClientRolesID, [Type]=@Type
                WHERE [ID] = @PKID
        END