You are here:Home » tsql » DDL TRIGGER TO DENY ALTER TABLE PERMISSION FROM UI

DDL TRIGGER TO DENY ALTER TABLE PERMISSION FROM UI

CREATE TRIGGER Deny_UI_ACCESS
ON DATABASE
FOR
CREATE_TABLE, ALTER_TABLE, DROP_TABLE
AS
BEGIN
IF APP_NAME() = N'MICROSOFT SQL SERVER MANAGEMENT STUDIO'
BEGIN
ROLLBACK TRAN
PRINT 'YOU ARE NOT ALLOWED TO EDIT TABLES WITH THE GUI'
RETURN
END
END