Stored Procedures [dbo].[MssWebGetItemCodeLookupItems]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inSearchvarchar(100)100
@inRevenueGroupIdint4
@inPageSizeint4
@inPageNumberint4
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
CREATE PROCEDURE [dbo].[MssWebGetItemCodeLookupItems]
    @inSearch VARCHAR(100) = NULL,
    @inRevenueGroupId INT = NULL,
    @inPageSize INT,
    @inPageNumber INT
AS
BEGIN
    SET NOCOUNT ON;

    SELECT
        ItemCode.ItemCode as ItemCode,
        ItemCode.Description as Description
    FROM
        ItemCode
    INNER JOIN
        RevGroups ON RevGroups.RGPriKey = ItemCode.RGPriKey
    WHERE
        (@inRevenueGroupId IS NULL OR RevGroups.RGPriKey = @inRevenueGroupId)
        AND (
            @inSearch IS NULL OR
            ItemCode.ItemCode LIKE @inSearch + '%' OR
            ItemCode.Description LIKE @inSearch + '%'
        )
    ORDER BY
        ItemCode.ItemCode
    OFFSET @inPageNumber * @inPageSize ROWS
    FETCH NEXT @inPageSize ROWS ONLY;
END;
GO
GRANT EXECUTE ON  [dbo].[MssWebGetItemCodeLookupItems] TO [MssExec]
GO
Uses