Search this blog

Wednesday, June 3, 2009

Find, When SQL Table was Modified?

SYS.DM_DB_INDEX_USAGE_STATS - This Object Provides the statistics of operation performed on the object recently.

By using this object we can find, when the data are updated on a table recently

Use This Following Query to Find the Date and Time of Data Modified or Updated in the Table

SELECT

OBJECT_NAME(OBJECT_ID) AS DB_Object_Name,

last_user_update

FROM

SYS.DM_DB_INDEX_USAGE_STATS

WHERE

database_id = DB_ID( 'DB_Name') AND

OBJECT_ID=OBJECT_ID('Table_Name')

Customize this Query with,

'DB_Name' - Enter Your DatabaseName

'Table_Name' - Enter Your TableName wants to Check

No comments:

Post a Comment