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 is the federation in sql azure?
What are database states in ms sql server?
What does null mean?
What is the use of custom fields in report?
Tell me extended events in sql server 2008?
What is log in sql server?
Tell me about builtinadministrator?
What is openxml in sql server?
How optimize sql query with multiple joins in sql server?
What does it mean if @@cursor_row returns a negative number?
Which are the important points to note when multilanguage data is stored in a table?
Explain why variables called the most powerful component of ssis?
What changes in the front end code is needed if mirroring is implemented for the high availability? : sql server database administration
Which are the two editions in which SQL Azure database available?
What are the steps you can take to avoid “deadlocks”?