Color scheme: Dark
You are here: start » en » Documentation » Data integration and data access » WKL Database Gateway » Troubleshooting » A view returns duplicate or missing rows when paging

A view returns duplicate or missing rows when paging

If you read a view window by window (next links, $skip), you find some rows twice and others not at all.

Environment

Sets the service offers without a key: tables without a unique key and views for which SQL Server reports no key that the view shows completely; every interface. $metadata shows whether a set has a key (<Key>).

Cause

A window with an offset is repeatable only over a fixed order. The service adds a fallback sort order only from the set's key (see OData: keys); without a key there's none, and an invented sort order would look like a promise without being one. The service still offers the next link—without it, the caller would certainly stop after the first window; with it, the result is only possibly inaccurate.

Resolution

  1. Specify $orderby over columns that are unique together.
  2. Or read in one window if the set stays under Limits:MaxTop.

Verification

The sum of the rows read equals $count, and no key combination occurs twice.

en/wiki/data-conectivity/database-gateway/troubleshooting/view-returns-duplicate-rows-when-paging.txt · Last modified: by Wolfgang van der Stille