Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Hi i have create this query in sql server 2008

SQL
select stud_id from student_master
order by stud_id desc
OFFSET (10*10) ROWS  FETCH NEXT 200 ROWS ONLY


but when i run this query i have error like this

Msg 102, Level 15, State 1, Line 5
Incorrect syntax near 'OFFSET'.
Msg 153, Level 15, State 2, Line 5
Invalid usage of the option NEXT in the FETCH statement.

what is a problem in my query please give me some idea or example thanks to advance
Posted
Comments
Sandeep Singh Shekhawat 13-Jan-14 5:14am    
Because SQL server 2008 doesn't support it. You should go with SQL server 2012 or try to something else. I will suggest you to rownumber function of SQL server

Why you are using (10*10)?

SQL
SELECT First Name + ' ' + Last Name FROM Employees ORDER BY First Name OFFSET 10 ROWS FETCH NEXT 5 ROWS ONLY;

Try like this.
 
Share this answer
 
v2
i tried the code in SQL Server 2012 and it went well.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900