How do I get the last Inserted / Modifed Record

Posted by Gokula*123 under Sql Server on 8/19/2010 | Points: 10 | Views : 2639 | Status : [Member] | Replies : 1

How do I get the last inserted and modified record in SQL Server 2005?

For example, I have modified the 5th record in Table1, insert 10th record in Table2, modified 8th record in Table3.

I want to know last modified / inserted record in each table

If I queried with Table1 will display 5th record has modified, Table2 will display 10th record has inserted and, Table3 will display 8th record has modified.


Thanks & Regards,
GokulaKrishnan Ranganathan


Posted by: Shankul2784 on: 8/19/2010 [Member] Bronze | Points: 25


for modification, you can add a one column where you can update the modified date & time so that it will return you the updated record. Also for created date, you can create a created date column & in default write the getdate() function so that there is no need to write any statement & you will get result.

I hope, this will help you.

Thanks & Regards,


Gokula*123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response