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
What are the filtered indexes?
What is subquery in sql?
What is function of CUBE ?
What is cursor in ms sql server?
How can we migrate from SQL server to SQL Azure?
What is page in sql server?
Why do you want to join software field as you have done your BE in Electronics?
What is sqlcmd?
What is report snapshot?
What are a database and a data warehouse?
what are user defined datatypes and when you should go for them? : Sql server database administration
Explain the etl (extraction, transformation, and loading)?
what are the different types of SSRS reports?
optimization techinques
How to throw custom exception in Stored Procedure?