📜  禁用数据库删除 sql 代码示例

📅  最后修改于: 2022-03-11 15:04:57.605000             🧑  作者: Mango

代码示例1
CREATE OR ALTER TRIGGER TRG_PreventDropProductionDB ON ALL SERVER
FOR DROP_DATABASE
AS
BEGIN
    IF DB_NAME() = 'ProductionDatabase'
        BEGIN
            RAISERROR('You cannot drop the production database.', 16,1);
            ROLLBACK;
        END
END
GO