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

Answer Posted / bobby

select * from table_name where <Primary key Column-
name> != all
(select top (@@rowcount-3) <Primary key Column-name> from
Table_name)

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is pessimistic concurrency?

731


How to create an identity column?

875


Why is sql server log file full?

762


What is a transact-sql statement batch in ms sql server?

687


How can we check the sql server version?

757


What is the difference between a view and a stored procedure?

776


How to remove duplicate rows from table except one?

748


How to verify a login name with sqlcmd tool?

816


What is cursor in ms sql server?

789


What is the use of @@spid?

762


What is the purpose of self join?

682


What do you mean by collation recursive stored procedure?

800


Explain the working of sql privileges?

821


Why do we need different type of parameter?

770


What is spatial and temporal data?

724