if i have 1000 records and i want to access 20 ata time
from SQL server, what will be the query?

Answer Posted / santosh

u can easily done by the use of Row_number() in sqlserver.

Ex:-

declare @Lower_Bound int,@Upper_bound int
SET @Lower_Bound=1 -- change this as per requirement
SET @Upper_bound=20 -- change this as per requirement
Select Id,Name from(select row_number()over(order by id asc) as Temp_Id,Id,Name from M_Student)
M_Student where Temp_Id >=@Lower_Bound and Temp_Id<=@Upper_bound


Here My Table Name is M_Student(Id,Name) & I have made a Temporary Id column(Temp_Id).Here the result.
Thank U......

If any query then u can connect me through

santosh.primetechsoftware@gmail.com

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you ensure a permanent cookie?

779


How ASP and ASP.NET page works? Explain about asp.net page life cycle?

795


What is server infrastructure & server components?

982


What are the data controls available in asp.net?

729


How will you do Redo and Undo in a TextControl?

892


Why session is used in asp.net?

785


Explain significance of routing? : asp.net mvc

809


What is virtual directory in asp.net?

782


Explain the difference between asp.net mvc and asp.net webforms

805


What is server infrastructure?

828


Do you know caching feature?

760


Explain the difference between an exe and a dll?

737


What is viewstate? What does the “enableviewstate” property do?

741


Describe session handling in a webfarm, how does it work and what are the limits?

835


Explain the difference between webfarm and webgardens in .net?

748