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
Explain throw statement in sql server 2008?
Detail about the hardware which is supported by SQL server?
How to apply filtering criteria at group level with the having clause in ms sql server?
what changed between the previous version of sql server and the current version? : Sql server database administration
Explain partitioned view?
what is memory-optimized nonclustered indexes
You accidentally delete the msdb database what effect does this have on your existing sql databases, and how do you recover?
Can a cursor be updated? If yes, how you can protect which columns are updated?
What are the difference between primary keys and foreign keys?
What are the differences between char and varchar in ms sql server?
What happens when unicode strings concatenate with non-unicode strings?
What is a constant or literal in ms sql server?
How to Update from select query in sql server?
Where are sql server user names and passwords stored in sql server?
Can primary key be a foreign key?