How to Keep Modifier ID in System Versioned Temporal Tables?
Asked Answered
Z

2

7

I have a system-versioned table in sql server 2016. I want to store Modifier ID in its temporal (history) table while users are performing delete or update action on the table.

Is there any built-in solution by sql server 2016 to do that?

Zygophyte answered 6/8, 2016 at 6:48 Comment(0)
S
4

You can use Audit

Introduction to sql server 2008 audit

Schwerin answered 6/8, 2016 at 8:25 Comment(0)
H
4

No it is not possible because the Temporal tables and their History tables has to have exactly the Same Schema i.e

  • number of columns
  • column names
  • data types
  • and even the ordering of the columns

So unless you are capturing the Modifier's ID in the Temporal tables itself, you cannot add this information to the history table.

How would you capture this Modifier's ID information in the Temporal table itself, well this can be handled on the application layer.

Hypocotyl answered 6/8, 2016 at 8:0 Comment(1)
That's a drawback for me. They can at least add an option to mark such column as hidden from the original table (like the period columns),Treiber
S
4

You can use Audit

Introduction to sql server 2008 audit

Schwerin answered 6/8, 2016 at 8:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.