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 / ramana

Table Like this

Create Table Employee(Name varchar(20),Location
varchar(20),Salary int)

Query Like this

Select top 1 * from employee where Name not in(select top 1
Name from Employee)

it will display second record....

Is This Answer Correct ?    2 Yes 2 No

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

Answer / madhuparna

select top 1 * from (select top 2 * from employee)A

Is This Answer Correct ?    0 Yes 0 No

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

Answer / prabhat sharma

select top 1 * from xyz where rno > (select top 1 rno from xyz)

rno is a column name and xyz is a table name

Is This Answer Correct ?    0 Yes 0 No

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

Answer / jayaraman b

select min(emp_no) from
(select top 2 * from emp order by emp_no desc)A
--This will give you the 2nd largest Salaried employee

select max(emp_no) from
(select top 2 * from emp order by emp_no desc)A
--This will give you the 1st largest Salaried employee

Is This Answer Correct ?    0 Yes 0 No

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

Answer / ravi

select top 2 from tablename

Is This Answer Correct ?    6 Yes 28 No

Post New Answer

More SQL Server Interview Questions

What is Report Server,Report Manager and Report Builder in SSRS 2005?

1 Answers  


Do you know what is difference between stored procedure and user defined function?

0 Answers  


What is precedence constraint?

0 Answers  


Can we use where clause in union?

0 Answers  


Explain collation?

0 Answers  






What is user-defined function? Explain its types i.e. Scalar and inline table value user-defined function?

0 Answers  


How to add additional conditions in SQL?

0 Answers   Amdocs,


Indexes are updated automatically is the full-text index also updated automatically?

0 Answers  


How to select some specific columns from a table in a query in ms sql server?

0 Answers  


What is b tree index?

0 Answers  


What are alternate keys?

0 Answers  


hi to all teachers,... Friends who write in the query mode Full text Search in Sql Server have experience Who make(Convert) this Stored Procedure as a normal Full text Search, which contains and .. Is used, into Advance of the tips I have thanked all friends perfection. Email : rezaafandi@yahoo.com Create PROCEDURE Sp_student @fname varchar(50), @lname varchar(50), @tel varchar(50), @code varchar(50), @adr varchar(50), @search_operation varchar(50), @totalRowCount bigint output AS begin if @search_operation = 'and' begin SELECT f3,f4,f5,f6,f7 FROM tb_student WHERE( f5 like '%' + @fname + '%' and f4 like '%' + @lname + '%' and f6 like '%' + @tel + '%' and f7 like '%' + @code + '%' and f3 like '%' + @adr +'%' ) select @totalRowCount = @@rowcount end

0 Answers  


Categories