Create Logon Trigger
CREATE TRIGGER logon_trigger_not_from_excel
ON ALL SERVER FOR LOGON
AS
BEGIN
IF APP_NAME() LIKE '%excel%'
ROLLBACK
END
Drop Logon trigger
DROP TRIGGER logon_trigger_not_from_excel ON ALL SERVER
Which trigger appear in SQL Server
SELECT name, s.type_desc SQL_or_CLR,
is_disabled, e.type_desc FiringEvents
FROM sys.server_triggers s
INNER JOIN sys.server_trigger_events e ON
s.object_id = e.object_id
What is the metadata of Trigger?
SELECT t.name, m.definition
FROM sys.server_sql_modules m
INNER JOIN sys.server_triggers t ON
m.object_id = t.object_id
Refenrece:
Logon Triggers
Frederik Vandeputte : SQL Server Logon triggers part 2
Viewing DDL Triger Medatdata by joining sys.server_SQL_modules and sys.server_triggers
No comments:
Post a Comment