0

I'm trying to read data using SqlDataReader. When using SQL Server 2014 I've added the code to my query:

.
ORDER BY STATEMENT_ID ASC
   OFFSET @beginRow ROWS
   FETCH NEXT @offs ROWS ONLY

This works for me in SQL Server 2014 whereas in SQL Server 2008 r2 it doesn't. What is the equivalent to this operation in SQL Server 2008 R2? Is there any, or should I change my approach!?

Thanks in advance.

marc_s
  • 675,133
  • 158
  • 1,253
  • 1,388
Biryukov Pavel
  • 379
  • 3
  • 18
  • When you say "it doesn't work" can you be more specific? I think it may also be a duplicate of this: – Reisclef Oct 25 '15 at 08:24
  • Ammm i know i can't use OFFSET\FETCH in sql 2008 it doesn't support this kind of query. I'm looking for an alternative way for reading chunks of rows using c# to sql server 2008. – Biryukov Pavel Oct 25 '15 at 08:36
  • 1
    There are some solutions linked in that post I. E. http://stackoverflow.com/questions/2135418/equivalent-of-limit-and-offset-for-sql-server?lq=1 – Reisclef Oct 25 '15 at 08:55
  • Thanks @Reisclef the thread you mentioned above is the exact solution. – Biryukov Pavel Oct 25 '15 at 14:59

0 Answers0