SQL Server 2012: Is it possible to exempt some columns from triggering a history table update?

342 views Asked by At

I've created a database to track computers at my company. The goal is for the data to be automatically updated nightly and any changes tracked in a history table. I created a temporal table and everything seems to work fine. However, I'd like to exempt the column that contains the lastLogon from AD for each computer account. History of the data is irrelevant, it would result in many unnecessary updates to the history table and I'm concerned it would grow too quickly. Is there any way to do something like "Update the history table on changes to any column EXCEPT m_lastLogon"?

2

There are 2 answers

0
Laughing Vergil On BEST ANSWER

The only way you will be able to do this is to store the m_lastlogon information in a separate, non-temporal table. However, you are losing some potentially valuable logging information that way, especially for usage patterns and possible accidental damage tracking. You may choose to have a simple login log table correlated to the hardware, so that only the login information is tracked, reducing the unnecessary multiple recording of the rest of the information.

0
DeanOC On

According to a comment made by Borko Novakovid (a Program Manager in the SQL Server team), you cannot exclude columns.

His comment was

Currently we do not support filtering out changes that occur on columns one is not interested to track in DW schema (I guess that was the question). We are aware that some people need this capability, but modifying ETL logic to exclude these updates is also viable option...

Here's the link to the webpage

https://channel9.msdn.com/Shows/Data-Exposed/Temporal-in-SQL-Server-2016