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 normalization and its types?
What is raid? : SQL Server Architecture
What is the purpose of grouping data in a report?
Explain what is scheduled job and how to create it?
What are the system database in sql server 2008?
What is a cache in ssrs?
what are user defined datatypes? : Sql server database administration
Why do we use sql limitations? Which constraints can we use while making a database in sql?
How to join two tables in a single query in ms sql server?
What is the default port for SQL Server over a firewall?
What is difference between Datepart() and Datename() in SqlServer?
What is a raid and what are different types of raid configurations?
How retrieve field names from the table in SQL through JAVA code?
What are sql server procedures?
How do I find my localdb version?