There is SQL Server 2012 database that is used by three different applications. In that database there is a table that contains ~500k rows and for some mysterious reason this ta
This is a possibility that may help you. It creates a trigger on Table1
that sends an email when a process DELETE
s more than 100 records. I'd modify the message to include some useful data like:
@@SPID
)HOST_NAME()
)APP_NAME()
)CREATE TRIGGER Table1MassDeleteTrigger
ON dbo.Activities
FOR DELETE
AS
DECLARE @DeleteCount INT = (SELECT COUNT(*) FROM deleted)
IF(@DeleteCount > 100)
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'MailProfileName',
@recipients = 'admin@yourcompany.com',
@body = 'Something is deleting all your data!',
@subject = 'Oops!';