Sql-server – Getting information regarding the data into tables insert,update or delete in sql server

sql server

Is there a way to retrieve information for tables in my database that can illustrate what DML has or has not occurred for a time period? What information, if any, does SQL Server store?

Best Answer

SQL Server does not have an automatic time keeping system to keep track of inserts, updates or deletes on tables, especially user tables.

If you have a set of columns that are maintained in some automated fashion that you trust explicitly to keep track of these operations that are part of the tables you are interested in, you can use those.

Alternatively, you can have a very lightweight trace or set of extended events running to capture when these things happen that you would then refer to, in order to know when these operations happen. Those have to be set up and running when the operation happens, though, as that information is not available after the fact.