I have a project based on SQL Server 2008. There is table with millions of rows, I need to fetch some rows between two dates (there is a column cdate
), need to output a sheet file for the same, but it's not possible to fetch all rows at once(request timeout problem), so I find a way to break in multiple requests to write on sheet. But for this I need to have a way to select only some rows like limit and offset in mysql. Is there a way to do this???
Microsoft Transact-SQL equivalent of limit
is top
.
select top 100
whicheverColumns
from
whicheverTable
where
whicheverFilteringCriteria
order by
whicheverDateEtc desc; -- or ASC is default