ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
how to retrive only second row from table in sql server 
2000?
 Question Submitted By :: Ravi148
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how to retrive only second row from table in sql server 2000?
Answer
# 1
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 ?    3 Yes 2 No
Arun Kumar K S
 
  Re: how to retrive only second row from table in sql server 2000?
Answer
# 2
----------------------------------
:), 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 ?    6 Yes 0 No
Dileep.t
 
 
 
  Re: how to retrive only second row from table in sql server 2000?
Answer
# 3
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 ?    0 Yes 1 No
Ravi148
[Krypton Tech]
 
  Re: how to retrive only second row from table in sql server 2000?
Answer
# 4
Hi,

select top 1 * from (SELECT TOP 2 * from emp) A Order by 
empno desc
 
Is This Answer Correct ?    9 Yes 6 No
Suresh
 
  Re: how to retrive only second row from table in sql server 2000?
Answer
# 5
select top 2 from tablename
 
Is This Answer Correct ?    2 Yes 17 No
Ravi
 
  Re: how to retrive only second row from table in sql server 2000?
Answer
# 6
select min(id) from cms_dfm where id in (SELECT TOP 2 ID 
from CMS_DFM Order by 
ID desc)
 
Is This Answer Correct ?    2 Yes 3 No
Shashikant
 
  Re: how to retrive only second row from table in sql server 2000?
Answer
# 7
select top 1 * from(select top 2 * from  tbl_test order by 1
asc) as at order by 1 desc
 
Is This Answer Correct ?    10 Yes 2 No
Lekhraj
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
can we call stored Procedure in Function in Sql Server 2000 and vice versa. eSoft2
What is MSDE?  2
can you any body tell me which service pack is installed in the sql server?  3
i have 4 tables.. T1, T2, T3, T4.. these tables have the same structure and they store the information entered in different years.. T1 stored 2002, T2 stored 2003, T3 stored 2004 and T4 stored 2005.. i want to copy contents in T1 to T2, T2 to T3, T3 to T4 and T4 to T1.. how do i do that? Temp tables cannot be used..  2
How to handle errors in Stored Procedures. I want to display a message to the user in the .aspx page that is calling a stored procedure in it's code behind. please help me. 247Customer1
What is one of the first things you would do to increase performance of a query? For example, a boss tells you that ?a query that ran yesterday took 30 seconds, but today it takes 6 minutes? Wipro1
What should we do to copy the tables, schema and views from one SQL Server to another?  3
What is a materialized view?  2
what is mean by crystal repoart? ahere we will mainly use that?  1
What is mean by "fill factor" ? and what is mean by "Index "in sql? Logica-CMG1
What is the order in which the SQL query is executed? list them in order. CTS1
How will u get 5 years back record?  4
what is the difference between Delete and Truncate Geo-Research-Centre3
What are the main control-of-flow T-SQL constructs?  1
How to Check Whether a Global Temporary Exists in a SQL Database or not?  2
employee table has employee id ----------- empid ---------------- 1 2 3 3 3 4 5 5 5 6 6 6 7 here the values r repeated two times.how to select the repeated values only.i.e 3,5,6 should alone come.  2
wat is the main diff between sql server 2000and sql server 2005 Jade-Software6
In performance wise distinct is good or group by is good? eg:select name from emp group by name; select distinct name from emp; Infosys4
What is an extended Stored Procedure?  1
What are cursors?  8
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com