Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 query

Author  Topic 

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-12-29 : 09:13:57
How to know the last updated row or column information in a table in sql server 2005

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-29 : 09:18:55
Do you have any timestamp column?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-12-29 : 09:21:14
No only datetime
Go to Top of Page

raky
Aged Yak Warrior

767 Posts

Posted - 2009-12-29 : 09:23:27


hi try this

select top 1 * from table order by <datetimecolumn> desc

Note: This datetimecolumn should be updated when any column is changed in that row
Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-12-29 : 09:27:42
thank you for that and more question if i want to know the tablewise how to know that i.e like last updated table wise
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-29 : 09:43:45
quote:
Originally posted by rajasekhar857

thank you for that and more question if i want to know the tablewise how to know that i.e like last updated table wise

You need to have a trigger on each table to record this or you may need to run a trace constantly which are not recommended

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -