"AddLink" Stored Procedure

Description:

This stored procedure adds a new link to a discussion for a specific Links module in the portal. The input parameters include title, Url, view order and description for the link. The output parameter is the ItemId of the new database record.

Definition:
    
    CREATE PROCEDURE AddLink
    (
        @ModuleID    int,
        @UserName    nvarchar(100),
        @Title       nvarchar(100),
        @Url         nvarchar(250),
        @MobileUrl   nvarchar(250),
        @ViewOrder   int,
        @Description nvarchar(2000),
        @ItemID      int OUTPUT
    )
    AS

    INSERT INTO Links
    (
        ModuleID,
        CreatedByUser,
        CreatedDate,
        Title,
        Url,
        MobileUrl,
        ViewOrder,
        Description
    )
    VALUES
    (
        @ModuleID,
        @UserName,
        GetDate(),
        @Title,
        @Url,
        @MobileUrl,
        @ViewOrder,
        @Description
    )

    SELECT
        @ItemID = @@Identity
        
Database Tables Used:

Links:  Each record in the Links table is a hyperlink, as displayed by the Links Portal Module. Since all Links 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 the link description is limited to 4000 characters.