Postman collection
Customers Read

pixiReadCustomers

Returns customer master records from the `Customers` table, either one customer by key or a page filtered by create/update date ranges.

Reads customer master data from Customers. Every branch returns the same column list. The parameters select exactly one branch, checked in this order:

  1. Create or update date: if CreateAndUpdateDateFrom or CreateAndUpdateDateTo is set, customers with CustKey > @CustKey are returned whose CreateDate or UpdateDate is >= From and whose CreateDate or UpdateDate is < To. Each bound is ignored if it is NULL.
  2. Create date: otherwise, if CreateDateFrom or CreateDateTo is set, customers with CustKey > @CustKey and CreateDate >= From and CreateDate < To are returned.
  3. Update date: otherwise, if UpdateDateFrom or UpdateDateTo is set, customers with CustKey > @CustKey and UpdateDate >= From and UpdateDate < To are returned.
  4. Key range: otherwise, if RowCount is passed (any value, including 0), all customers with CustKey > @CustKey are returned.
  5. Single customer: otherwise the customer with CustKey = @CustKey is returned.

If CustKey is not passed, it is set to 0. In the date and key range branches this means "start at the beginning". In the single customer branch it means a lookup of key 0, which normally returns no row.

The lower date bounds are inclusive and the upper bounds are exclusive. Branches 1–4 are sorted by CustKey ascending. If RowCount is not 0, the number of rows is limited with SET ROWCOUNT.

Paging: pass the last CustKey of the previous page as CustKey together with RowCount.

Notes

  • In the date branches CustKey is an exclusive lower bound, not an exact match. Passing a customer key together with a date filter returns the customers after that key.
  • Only one date filter group is used. CreateAndUpdateDate* takes precedence over CreateDate*, which takes precedence over UpdateDate*. If more groups are passed, the others are ignored.
  • In the combined filter the upper bound is also an OR condition. A customer created before CreateAndUpdateDateTo matches even if it was last updated after that date, and the other way round.
  • RowCount = 0 selects the key range branch but does not limit the rows, so all customers after CustKey are returned.
  • The table is read WITH (NOLOCK), so uncommitted data can be returned.
  • The result contains sensitive data such as Password, credit card fields (CardNr, CardExp) and bank details (Account, BLZ). Handle it accordingly.
  • The final "no data" branch (WHERE 1 = 0) cannot be reached, because CustKey is never NULL after the default replacement.
  • Column data types are not visible in the procedure. They come from the Customers table.

Tables used

Customers · Read
SQL object:
dbo.pipiReadCustomers
Updated at 2026-10-30