We faced the below error when run query with offset ... rows.. fetch next...
Msg 33557097, Level 16, State 1, Line 57
syntax error at or near "ROWS"
Total execution time: 00:02:42.886
This error occurs in the pagination part of the query:
OFFSET @REGISTROS_POR_PAGINA * (@PAGINA - 1) ROWS
FETCH NEXT @REGISTROS_POR_PAGINA ROWS ONLY
The declarations are like this:
DECLARE @PAGINA INT = 1;
DECLARE @REGISTROS_POR_PAGINA INT = 2147483646;
NOTE: The query syntax is correct, it runs normally in SQL Server (on premises)