Click here to Skip to main content
15,886,693 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need a query by which I can get to know that when I insert a record in the table suppose I insert the 5 record in the table I can retrieve the same, how can I do so in sql server 2005?
Posted
Updated 1-Nov-12 8:21am
v2

I second what Solution 1 was.
Here is link which is similar to question and its solution

I want a sql query for latest 25 rows[^]
 
Share this answer
 
Add One More Column To Your SQL Table sNO With DataType Numeric(18,0) And Identity Specification Yes. If Your Table Already Contain Column Like this then Use this Column insted of sNO Then Use Following SQL Query :
SQL
SELECT TOP(1) * FROM TABLENAME ORDER BY sNO DESC

I hope it will help you. :)
 
Share this answer
 
This link can help you

http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/
 
Share this answer
 
v2
If you are using SQL Server you would need a time-stamp column or an incremental column.
Other database servers may have this build in.
 
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