The following is an example of an online:
- reference and record operation example
- create a record log table
The create table t_log (
Id int identity (1, 1) primary key,
Work stops nchar (30) not null default host_name (),
The operator sysname DEFAULT SUSER_SNAME (),
Operating time datetime default getdate (),
The event type nvarchar (30),
Parameter int,
Execution of the statement nvarchar (255))
Go
- the demonstration data table
Create table test (id int)
Go
- record operation trigger
Create the trigger t_update on test
For insert, update, delete
As
Insert t_log (event type, parameters, the execution of statements) exec (' DBCC inputbuffer (@ @ spid) ')
Go
- initialize the table
Insert into test values (1)
Go
Update the test set id=100
Go
- display record
Select * from t_log
Go
- delete the demo environment
Drop table t_log, test
CodePudding user response:
Do you have any good methods to monitor who to perform the delete operationCodePudding user response:
Refer to https://blog.csdn.net/ap0405140/article/details/8896330CodePudding user response: