how to retrive only second row from table in sql server
2000?

Answers were Sorted based on User's Feedback



how to retrive only second row from table in sql server 2000?..

Answer / lekhraj

select top 1 * from(select top 2 * from tbl_test order by 1
asc) as at order by 1 desc

Is This Answer Correct ?    24 Yes 5 No

how to retrive only second row from table in sql server 2000?..

Answer / dileep.t

----------------------------------
:), This will also work, without additional columns in
result
---------------------------------

DECLARE curTemp SCROLL CURSOR FOR
SELECT TOP 2 * from <TABLE_NAME>
OPEN curTemp
FETCH LAST FROM curTemp
CLOSE curTemp
DEALLOCATE curTemp

Is This Answer Correct ?    12 Yes 2 No

how to retrive only second row from table in sql server 2000?..

Answer / suresh

Hi,

select top 1 * from (SELECT TOP 2 * from emp) A Order by
empno desc

Is This Answer Correct ?    16 Yes 9 No

how to retrive only second row from table in sql server 2000?..

Answer / yogesh

select top 1 from tablename where id <(select top 1 id from
test)

Is This Answer Correct ?    5 Yes 0 No

how to retrive only second row from table in sql server 2000?..

Answer / arun kumar k s

drop table #temp select top 2 identity(int,1,1) as SlNo, *
into #temp from TABLE_NAME select * from #temp where SlNo=2

Is This Answer Correct ?    7 Yes 5 No

how to retrive only second row from table in sql server 2000?..

Answer / ravi148

hi,

dileep is exactly correct , arun .. iam sorry to say ur
wrong

suppose for employee table, write as
DECLARE curTemp SCROLL CURSOR FOR
SELECT TOP 2 * from EMPLOYEE
OPEN curTemp
FETCH LAST FROM curTemp
CLOSE curTemp
DEALLOCATE curTemp

Is This Answer Correct ?    4 Yes 2 No

how to retrive only second row from table in sql server 2000?..

Answer / shashikant

select min(id) from cms_dfm where id in (SELECT TOP 2 ID
from CMS_DFM Order by
ID desc)

Is This Answer Correct ?    6 Yes 4 No

how to retrive only second row from table in sql server 2000?..

Answer / belson gnana pradeep

SELECT TOP 1 salary FROM
(SELECT DISTINCT TOP 2 salary FROM employee
ORDER BY salary DESC) a ORDER BY salary

Is This Answer Correct ?    2 Yes 0 No

how to retrive only second row from table in sql server 2000?..

Answer / vardharaj

SELECT TOP 1 ID FROM TABLENAME WHERE ID NOT IN (SELECT TOP 1
ID FROM TEST)

Is This Answer Correct ?    2 Yes 1 No

how to retrive only second row from table in sql server 2000?..

Answer / surenda tarai

select top 1 * from(select top 3 * from tablename order by 1
asc) as at order by 1 desc

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL Server Interview Questions

How do indexes help, types?

0 Answers  


What the class forname () does?

0 Answers  


What is SCOPE_IDENTITY() in sql

4 Answers   Cap Gemini,


What is a job?

3 Answers  


I have a table Events Events containing cardno,time,id,name- -each id has a cardno my requirement is every day each employee swipe the card several times i want to calculate first and last time of each card the output should be name 1 2 6 7 in out in out holiday holiday xxx 09:30 06:30 09:40 06:45 where 1,2...... are dates for example january 1,2, etc. 6 and 7 are saturday and sunday how it is posssible

0 Answers  






Why would you call update statistics?

0 Answers  


WHICH IS THE BEST INSTITUTE IN HYD FOR "ORACLE"?

3 Answers  


What is difference between createstatement and preparedstatement?

0 Answers  


Tell me what is use of except clause? How it differs from not in clause?

0 Answers  


Do you know what are the restrictions that views have to follow?

0 Answers  


in how many ways we can use count()

2 Answers  


How to integrate the ssrs reports in application?

0 Answers  


Categories