How to select nth record from a table?
Answers were Sorted based on User's Feedback
Answer / ravinder pawar
Hi Frnds,
Pravin's logic is correct. I am just modifying it little
bit.
Select Top 1 *
From (Select Top 5 *
from HumanResources.Employee
order by EmployeeID desc)as temp
---Note If we don't use temp we'll get error as mentioned
below:
Incorrect syntax near ')'.
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / pravin s. ahire
Select Top 1 *
From (Select Top N * from tablename order by
table.ColumnName desc)
-- where N = nth record
Is This Answer Correct ? | 0 Yes | 3 No |
Answer / sajida
--For ex in dept table to select 5th record. Instead of
this you can use &n so that it can ask row number
select rnum, d.* from dept d, (select rownum rnum ,
deptno from dept ) e
where d.deptno = e.deptno and rnum = 5
Is This Answer Correct ? | 5 Yes | 10 No |
What is an execution plan? When would you use it? How would you view the execution plan?
What are the differences between triggers and stored procedures?
How to work on DTS?what is the main requirement?
How to create a testing table with test data in ms sql server?
You want to implement the one-to-many relationship while designing tables. How would you do it?
What are the properties of the transactions?
How many index can be created for single table
4 Answers CarrizalSoft Technologies, Verizon,
What are database states in ms sql server?
What is Dependency Injection and provide example?
Suppose i have a table that contains 5 columns like col1,col2...colm5.I want to import only two column through BCP utility.How to do same through BCP in sybase.
You notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it?
what is checksum in sql server.........???