
[dbo].[MssWebGetAccountingCustomerLookupItems]
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