Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Keep Modifier ID in System Versioned Temporal Tables?

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?

like image 857
Nima Rostami Avatar asked Aug 06 '16 06:08

Nima Rostami


People also ask

What is a system-versioned temporal table?

Temporal tables (also known as system-versioned temporal tables) are a database feature that brings built-in support for providing information about data stored in the table at any point in time, rather than only the data that is correct at the current moment in time.

How do I change the versioned table in SQL Server?

BEGIN TRAN ---set system versioning to off ALTER TABLE [dbo]. [CompanyLocation] SET (SYSTEM_VERSIONING = OFF); ALTER TABLE [CompanyLocation] ADD Cntr INT IDENTITY (1,1); ALTER TABLE [dbo].


1 Answers

You can use Audit

Introduction to sql server 2008 audit

like image 98
Ahmad Aghazadeh Avatar answered Sep 30 '22 05:09

Ahmad Aghazadeh