Stored Procedures [dbo].[MssWebGetAccountingCustomerLookupItems]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inQueryvarchar(128)128
@inPageNumberint4
@inPageSizeint4
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
create procedure dbo.MssWebGetAccountingCustomerLookupItems
    @inQuery varchar(128) = null,
    @inPageNumber int,
    @inPageSize int
as
begin
    set nocount on;

    declare @offset int = @inPageNumber * @inPageSize;

    select
        Id = AccountingCustomer.AccountingCustomerId,
        CustomerName = AccountingCustomer.Name,
        CustomerNumber = AccountingCustomer.CustomerNumber
    from
        AccountingCustomer

    where
        @inQuery is null or
        AccountingCustomer.Name like @inQuery + '%' or
        AccountingCustomer.CustomerNumber like @inQuery + '%'

    order by
        AccountingCustomer.Name asc,
        AccountingCustomer.CustomerNumber asc

    offset @offset rows
    fetch next @inPageSize rows only;
end
GO
GRANT EXECUTE ON  [dbo].[MssWebGetAccountingCustomerLookupItems] TO [MssExec]
GO
Uses