SQL Offset/fetch NEXT BUG

Source: Internet
Author: User

Last week, the test found a paging bug---no matter how the page data was paged. All of our pagination is with EF paging, why is there a problem with only one module paging?

Later, following the SQL statement, we found that the new paging method used was sql2012 Offset/fetch next.

Here are two paragraphs of SQL statements,

DECLARE   @FetchRows tinyint = 8; SELECT * from Bnc_store ORDER by created_date ASC     OFFSET 0 rows     FETCH NEXT @FetchRows rows only; SELECT * from Bnc_store ORDER by Created_date ASC     OFFSET 8 rows     FETCH NEXT @FetchRows rows only; SELECT * from Bnc_store ORDER by created_date ASC     OFFSET + rows    FETCH NEXT @FetchRows rows only;

  

SELECT * from Bnc_store ORDER by created_date ASC OFFSET 0 rows FETCH NEXT 8 rows Only;select * from Bnc_store ORDER by Cr  Eated_date ASC offset 8 rows Fetch NEXT 8 rows Only;select * from Bnc_store ORDER by created_date ASC offset + rows Fetch NEXT 8 ROWS only;

  

If the values of create_date in the data are the same, you can see that the results are not the same.

If we change to an order by ID, the results on both sides are consistent.

All I personally think this is a Microsoft sql2012 bug

SQL Offset/fetch NEXT BUG

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.