Hocke_sweden
asked on
Can I find the last update time of a row in MS SQL server 2008 R1
Can I find the last update time of a row in MS SQL server 2008 R1?
I have updated a row, but Im not sure when, I dont have any date or time column
I have updated a row, but Im not sure when, I dont have any date or time column
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The timestamp field will be updated everytime data changes in the record
Datatype TIMESTAMP
Can use the system view sys.dm_db_index_usage_stat s to check the last_user_update column if the table has indexes.
ASKER
It has index, but I m not sure which id it it for that table, how can I see hat?
SELECT * FROM sys.dm_db_index_usage_stat s
SELECT * FROM sys.dm_db_index_usage_stat
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Be careful not to get confused betwen a timestamp field and the timestamp datatype.
A timestamp field contains a datetime, but you must update it yourself:preferably with a trigger if you are serious about monitoring the last update.
A timestamp datatype is updated automatically, but it does not contain a date or time!!! For the resulting confusion, the timestamp datatype has been deprecated and replaced with the rowversion datatype which works exactly the same.
A timestamp field contains a datetime, but you must update it yourself:preferably with a trigger if you are serious about monitoring the last update.
A timestamp datatype is updated automatically, but it does not contain a date or time!!! For the resulting confusion, the timestamp datatype has been deprecated and replaced with the rowversion datatype which works exactly the same.
ASKER
Can I get timestamp field to update every time the row is changed without changing the sql query?
Should the data type be datetime or?