DDL Triggers in SQL Server
DDL Triggers in SQL Server
USE TestDB
GO
CREATE TRIGGER trRestrictCreateTable
ON DATABASE
FOR CREATE_TABLE
AS
BEGIN
PRINT 'YOU CANNOT CREATE A TABLE IN THIS DATABASE'
ROLLBACK TRANSACTION
END
Right-click on the trigger in object explorer and select “Delete” from the
context menu. We can also drop the trigger using the following T-SQL
command