wat will be the sql query to extract only last 3 records
from table supose table hving thousands for records

Answer Posted / arun kumar k s

drop table #temp select identity(int,1,1) as SlNo, * into
#temp from TABLE_NAME select top 3 * from #temp order by
SlNo desc

arun_4454@yahoo.co.in

Is This Answer Correct ?    0 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define primary key?

655


What are the common performance issues in sql server?

497


What is dbcc?

731


What is the largest component inside a field?

530


How do I change my passwords (database, LDAP, and so on) without causing an outage?

598






Issues related in upgrading SQL Server 2000 to 2005 / 2008

1499


What is the use of “join” in sql server?

566


How to convert binary strings into integers in ms sql server?

551


What is sub-query in sql server?

664


Is the log file is a part of file group?

548


What is the use of partition by in sql server?

507


What is the difference between deallocate cursor and close cursor?

713


What are the basic features of a trigger in ms sql server?

565


How to edit table in sql server 2017?

506


What are the different subsets of sql?

949