There may come a time when you need to skip a certain number of rows while querying a database in SQL Server Management Studio. Here is an example used that I see from time to time:

Original data set:

Say we wanted to skip the first 5 records based on the SSN. We could do the following:

 

A better solution to this is to  use the OFFSET clause:

 

A catch to this is that you can’t use the TOP clause. If you need to get a TOP number of rows, append the FETCH clause onto OFFSET:

 

Ta-da! Magic man.

Back To Top