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
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?
What is the difference between stored procedure and functions?
What is the sql server agent?
can a database be shrunk to 0 bytes, if not, why? : Sql server administration
How to create nested stored procedure?
Difference between drill down and drill through report.
Explain four layers of abstraction microsoft architectured?
What is a field in a table?
What is the recovery model? List the types of recovery model available in sql server?
Explain an incremental backup?
What is molap and its advantage? : sql server analysis services, ssas
Which are the important points to note when multilanguage data is stored in a table?
How is sql server used?
what are candidate key, alternate key and composite key? : Sql server database administration
What are subqueries in sql server?