how to get 25th row in any table in sqlserver can u tell me
syntax
Answers were Sorted based on User's Feedback
Answer / sujitha
For Example TableName: Employee. Employee Have The
Following Fields.
Emp_No ( Identity Value)
Emp_Name
Designation
Select Top 1 * From Employee Where Emp_No Not in(Select
Top 24 Emp_No From Employee)
Is This Answer Correct ? | 13 Yes | 2 No |
Answer / 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 |
Answer / pradyumna
set rowcount 25
declare @temptable table
(id int identity(1,1),itemid int)
insert @temptable
select itemid from tbl123
select * from tbl123 where itemid=(select itemid from
@temptable where id=25)
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / nagaraju jella
select *
from securitytest_64.userroles u
where rowid =
(select max(rowid) from securitytest_64.userroles u
where rownum < 26)
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / svreddy
select *from emp a where 25=(select count(distinct(eno))from emp b where a.eno>=b.eno
Is This Answer Correct ? | 0 Yes | 0 No |
We create index colomn in that table . use that index
coloum we take the 25th row of that table .
Example
SELECT * FROM table1 WHERE index_coloumn = 25
Is This Answer Correct ? | 4 Yes | 8 No |
Answer / venkat
suppose the table x having a column with name empid
set rowcount 25
select * from x where empid not in (select top 24 empid
from x)
Is This Answer Correct ? | 1 Yes | 6 No |
Can we call stored procedure in trigger?
How to convert a numeric expression from one data type to another?
Table student containing 2 columns,Join date,Employee name. Under join date 4 rows r ter =1-jan-2008,2-feb-2008,3-mar- 2008,4-feb-2008.Under Employee name 4 difeerent names jaison,robin,binoy,rahul Result set is, Table containing 4-column name=jan,feb,mar,april,,beneath these months count is given as 1,2,1,0 means these counts representing number of emplooyees joined in a month(january 1employee,february 2 employee,march 1 employee,april 0 employee) Can you give me the required sql query
What are the Advantages of using CTE in sql server?
How do you open a cluster administrator?
How to use order by with union operators in ms sql server?
What are the 3 types of schema?
What will be the value of @@fetch_status if a row that was a part of the cursor resultset has been deleted from the database after the time the stored procedure that opened the cursor was executed?
How to modify an existing stored procedure in ms sql server?
How can I create a report based on a query? : sql server management studio
What are the properties of the transactions?
Can a stored procedure call itself or recursive stored procedure? How many levels sp nesting is possible?