how to get 25th row in any table in sqlserver can u tell me
syntax

Answer Posted / anand k

For Ex. We are Using State Table for this scenario.

Records In State Table is (Total 50 Rec)
Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
Hawaii
Idaho
Illinois
Indiana
Iowa
Kansas
Kentucky
Louisiana
Maine
Maryland
Massachusetts
Michigan
Minnesota
Mississippi
Missouri
Montana
Nebraska
Nevada
New Hampshire
New Jersey
New Mexico
New York
North Carolina
North Dakota
Ohio
Oklahoma
Oregon
Pennsylvania
Rhode Island
South Carolina
South Dakota
Tennessee
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming
--------

Now we are Selecting 25th record from the state table.

SELECT STA.*
FROM [State] STA,
(SELECT StateName,ROW_NUMBER() OVER (ORDER BY StateName)
ROWNO FROM [State] ) ROW
WHERE ROW.ROWNO = 25
AND ROW.StateNAme = STA.StateName
ORDER BY StateName

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

You are designing a database for your human resources department in the employee table, there is a field for social security number, which cannot contain null values if no value is given, you want a value of unknown to be inserted in this field what is the best approach?

633


What is the difference between stored procedure and functions?

606


What is the sql server agent?

593


can a database be shrunk to 0 bytes, if not, why? : Sql server administration

617


How to create nested stored procedure?

548






Difference between drill down and drill through report.

554


Explain four layers of abstraction microsoft architectured?

124


What is a field in a table?

586


What is the recovery model? List the types of recovery model available in sql server?

491


Explain an incremental backup?

603


What is molap and its advantage? : sql server analysis services, ssas

556


Which are the important points to note when multilanguage data is stored in a table?

520


How is sql server used?

556


what are candidate key, alternate key and composite key? : Sql server database administration

507


What are subqueries in sql server?

603