"AddContact" Stored Procedure

Description:

This stored procedure adds a new contact to the database for a specific module in the portal. The input parameters include the contact's name, role, team, email, and contact information, and the output parameter is the ItemId of the new database record.

Definition:
    
    CREATE PROCEDURE AddContact
    (
        @ModuleID int,
        @UserName nvarchar(100),
        @Name     nvarchar(50),
        @Role     nvarchar(100),
        @Email    nvarchar(100),
        @Contact1 nvarchar(250),
        @Contact2 nvarchar(250),
        @ItemID   int OUTPUT
    )
    AS

    INSERT INTO Contacts
    (
        CreatedByUser,
        CreatedDate,
        ModuleID,
        Name,
        Role,
        Email,
        Contact1,
        Contact2
    )

    VALUES
    (
        @UserName,
        GetDate(),
        @ModuleID,
        @Name,
        @Role,
        @Email,
        @Contact1,
        @Contact2
    )

    SELECT
        @ItemID = @@Identity
        
Database Tables Used:

Contacts:  Each record in the Contacts table is a single item, as displayed by the Contacts Portal Module. Since all Contacts 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.