Stopping Database Deletion at Serer Level Using Trigger.

--This Trigger(DDL Triggger.Created at Server Level)stops deleting Database unexpectedly.
CREATE TRIGGER DontDeleteDatabase
ON ALL SERVER
AFTER DROP_DATABASE
AS
BEGIN
PRINT 'Are You sure you want to Delete this Database.To do so, Please disable the trigger and Try.'
ROLLBACK----This is very important if we forgot this.Databse will drop instantly.
END

Comments

Popular posts from this blog

System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out

Pre login Handshake or Connection Timeout Period

Transparent Data Encryption(TDE) with Master Key and Certificate in SQL Server