SQLGeneration icon indicating copy to clipboard operation
SQLGeneration copied to clipboard

T-SQL Offset and Fetch

Open dazinator opened this issue 9 years ago • 0 comments

for T-SQL, Offset and Fetch are often used for paging.

Select blah from blah
order by blah
OFFSET((@pageNumber - 1) * @pageSize) ROWS
FETCH NEXT @pageSize ROWS ONLY; 

basically skipping x ROWS and then taking X rows.

Would be nice if this could be supported in the parser - but I understand that this might be t-sql specific.

Never really discussed how best to create database specific variants of SQL generation, but I always assumed you'd have an agnostic model to represent the structure / nature of the sql command, and then the formatter could output the command according to different language variants. That's great for formatting the output, but I am not sure whether there is anything in place for parsing different language variants.

dazinator avatar Dec 07 '16 15:12 dazinator