160
Views
5
Comments
Solved
SQL Server OFFSET FETCH
Question

Hi,

How  to use the SQL OFFSET FETCH clauses to limit the number of rows returned by a query in 

traditional web for advanced or aggregate query.


Thanks,

Rodrigo



Hi Rodrigo,

you can try this on advanced  query.

SELECT {JulyReport}.[Id],{JulyReport}.[SELB],{JulyReport}.[Equipamento] from {JulyReport}
order by {JulyReport}.[Id],{JulyReport}.[SELB],{JulyReport}.[Equipamento] asc
OFFSET @StartIndex ROWS 
FETCH NEXT @RowCount ROWS ONLY

Hope this will help you.

Vijay M-

UserImage.jpg
Rodrigo Misiac

Vijay Malviya wrote:

Hi Rodrigo,

you can try this on advanced  query.

SELECT {JulyReport}.[Id],{JulyReport}.[SELB],{JulyReport}.[Equipamento] from {JulyReport}
order by {JulyReport}.[Id],{JulyReport}.[SELB],{JulyReport}.[Equipamento] asc
OFFSET @StartIndex ROWS 
FETCH NEXT @RowCount ROWS ONLY

Hope this will help you.

Vijay M-

Thanks for quick reply.

 

Rodrigo Misiac wrote:

Vijay Malviya wrote:

Hi Rodrigo,

you can try this on advanced  query.

SELECT {JulyReport}.[Id],{JulyReport}.[SELB],{JulyReport}.[Equipamento] from {JulyReport}
order by {JulyReport}.[Id],{JulyReport}.[SELB],{JulyReport}.[Equipamento] asc
OFFSET @StartIndex ROWS 
FETCH NEXT @RowCount ROWS ONLY

Hope this will help you.

Vijay M-

Thanks for quick You're

You're Welcome!


VIjay M-

In a SQL ADVANCE, you need use (example with 10):


  • SQL 
    • SELECT TOP 10 .... .... 
  • Oracle
    • ... ... WHERE ROWNUM <= 10


In a Aggregate:

  • The attribute for max. records in the aggregate can be filled with an variable
    • Note: you can use a variable, like maxrec, or can put directly a integer number. It's a optional field.



Cheers

Hi Rodrigo,

you can try this on advanced  query.

SELECT {JulyReport}.[Id],{JulyReport}.[SELB],{JulyReport}.[Equipamento] from {JulyReport}
order by {JulyReport}.[Id],{JulyReport}.[SELB],{JulyReport}.[Equipamento] asc
OFFSET @StartIndex ROWS 
FETCH NEXT @RowCount ROWS ONLY

Hope this will help you.

Vijay M-

UserImage.jpg
Rodrigo Misiac

Vijay Malviya wrote:

Hi Rodrigo,

you can try this on advanced  query.

SELECT {JulyReport}.[Id],{JulyReport}.[SELB],{JulyReport}.[Equipamento] from {JulyReport}
order by {JulyReport}.[Id],{JulyReport}.[SELB],{JulyReport}.[Equipamento] asc
OFFSET @StartIndex ROWS 
FETCH NEXT @RowCount ROWS ONLY

Hope this will help you.

Vijay M-

Thanks for quick reply.

 

Rodrigo Misiac wrote:

Vijay Malviya wrote:

Hi Rodrigo,

you can try this on advanced  query.

SELECT {JulyReport}.[Id],{JulyReport}.[SELB],{JulyReport}.[Equipamento] from {JulyReport}
order by {JulyReport}.[Id],{JulyReport}.[SELB],{JulyReport}.[Equipamento] asc
OFFSET @StartIndex ROWS 
FETCH NEXT @RowCount ROWS ONLY

Hope this will help you.

Vijay M-

Thanks for quick You're

You're Welcome!


VIjay M-

mvp_badge
MVP

Hi Rodrigo,

Refer the below forum link and the screen clip for sample implementation reference

https://www.outsystems.com/forums/discussion/56770/sql-offset-and-os-pagination/#Post214278


Hope this helps you!


Regards,

Benjith Sam

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.