"UpdateAnnouncement" Stored Procedure

Description:

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

Definition:
    
   CREATE PROCEDURE Portal_UpdateAnnouncement
   (
       @ItemID         int,
       @UserName       nvarchar(100),
       @Title          nvarchar(150),
       @MoreLink       nvarchar(150),
       @MobileMoreLink nvarchar(150),
       @ExpireDate     datetime,
       @Description    nvarchar(2000)
   )
   AS
   
   UPDATE Portal_Announcements
   
   SET
       CreatedByUser   = @UserName,
       CreatedDate     = GetDate(),
       Title           = @Title,
       MoreLink        = @MoreLink,
       MobileMoreLink  = @MobileMoreLink,
       ExpireDate      = @ExpireDate,
       Description     = @Description
   
   WHERE
       ItemID = @ItemID
        
Database Tables Used:

Announcements:  Each record in the Announcements table is a single item, as displayed by the Announcements Portal Module. Since all Announcement 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 announcement descriptions are limited to 2000 characters.