Sql Table audit without trigger

Last Reply 12 days ago By dharmendr

Posted 18 days ago

I have a below table schema

CREATE TABLE sales.customers (
	customer_id INT IDENTITY (1, 1) PRIMARY KEY,
	first_name VARCHAR (255) NOT NULL,
	last_name VARCHAR (255) NOT NULL,
	phone VARCHAR (25),
	email VARCHAR (255) NOT NULL,
	street VARCHAR (255),
	city VARCHAR (50),
	state VARCHAR (25),
	zip_code VARCHAR (5)
);

i want to create audit of this table without using trigger below is the audit table schema

CREATE TABLE sales.customersAudit (
	id INT IDENTITY (1, 1) PRIMARY KEY,
	Filed_Name NVARCHAR (max) NULL,
	Old_Value NVARCHAR (max) NULL,
	New_Value NVARCHAR (max) NULL
);

 

You are viewing reply posted by: dharmendr 12 days ago.
Posted 12 days ago

On each update you need to insert the record in the Audit table to maintan the log.