Checking which DROP queries were running on SQL Server

Someone continues to drop tables in one of our databases as soon as I get access to the server. I don’t know who it is. Because of this, I almost lost my job.

So, I was wondering if there is a way to check which user has fulfilled the request for DROP TABLE my_tableso that I can prove to my boss that I am innocent?

+3
source share
2 answers

In SQL Server 2005 or later, you can also examine DDL triggers that would even allow certain statements to be denied DROP TABLE....

CREATE TRIGGER safety 
ON DATABASE 
FOR DROP_TABLE
AS 
   PRINT 'You must disable Trigger "safety" to drop tables!' 
   ROLLBACK
;

This would basically just prevent anyone from dropping the table

+2
source
+3

All Articles