Bill
Bill

Reputation: 761

Is there a way to tell the last date time a table was modified in SQL Server 2012

Is there a way to tell the last date time any table records were modified in SQL Server 2012? without having to put in a column for last update in table.

The idea is not to query say a 10 million record table when no rows were changed.

Upvotes: 1

Views: 192

Answers (1)

Martin Smith
Martin Smith

Reputation: 453278

Is there a way to tell the last date time any table records were modified in SQL Server 2012? without having to put in a column for last update in table.

Yes - you can write an update/insert/delete trigger on the table that records the fact that an update happened along with the date and time.

The idea is not to query say a 10 million record table when no rows were changed.

You might also want to look at the built in Change Tracking features

Upvotes: 2

Related Questions