# "UpdateEvent" Stored Procedure

Description:

This stored procedure is used by the Events edit page to apply changes to an existing event item. The input parameters include the item's primary key (ItemID), plus title, WhereWhen, expiration date and description. The editor's UserName is also passed in, and used to update the CreatedByUser field.

Definition:

       CREATE PROCEDURE Portal_UpdateEvent
       (
           @ItemID      int,
           @UserName    nvarchar(100),
           @Title       nvarchar(100),
           @ExpireDate  datetime,
           @Description nvarchar(2000),
           @WhereWhen   nvarchar(100)
       )

       AS

       UPDATE Portal_Events

       SET
           CreatedByUser = @UserName,
           CreatedDate   = GetDate(),
           Title         = @Title,
           ExpireDate    = @ExpireDate,
           Description   = @Description,
           WhereWhen     = @WhereWhen

       WHERE
           ItemID = @ItemID

Database Tables Used:

Events: Each record in the Events table is a single item, as displayed by the Events Portal Module. Since all Events modules store their record in this table, each item contains a ModuleID to permit related items to be retrieved in a single query.

The primary key in this table is the ItemID identity field. Note that event descriptions are limited to 2000 characters.