SQL Server 2016 – How to Log SQL Statements Deleting Records

sql serversql-server-2016trigger

I have a SQL Server table where rows randomly get deleted. I want to check what is causing this as I see no issues from the application side.

I did create an after delete trigger and I am able to see which rows are being deleted, but that is still not helping pin-point on why some records are being deleted.

I am wondering if it is possible to log/track which executed SQL statement are deleting the rows from my table.

Please note I am using SQL Server 2016 Express edition.

Best Answer

You can use the help of SQL Profiler ..

Inside the profiler you can choose the events against your server..

enter image description here

enter image description here

enter image description here