Click here to Skip to main content
15,894,539 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i want to know, how to return recently inserted records in the database...


what should be the query??


actualy i am uploding images in the application...
and i want to show most recent images uploaded..
that is why i am asking for this query..
thanks... :)
Posted

Since you are using SQL Server 2005, you could also do:
SQL
SELECT TOP (@N) * FROM SomeTable ORDER BY SomeColumn DESC

Also, if you go the ROWCOUNT way, remember to set it back to 0 after you run your query.
 
Share this answer
 
i got the query..
it is..


SET ROWCOUNT N
SELECT * FROM table_name
ORDER BY column_name desc
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900