Reputation:
Where would a trigger be stored if I created it to trigger on "ALL SERVER".
CREATE TRIGGER trg_LogonAttempt ON ALL SERVER
FOR LOGON
AS
BEGIN
IF ORIGINAL_LOGIN() = 'dbo'
I would like to be able to find and modify it again if I close it down. I know where triggers are normally saved in the object explorer under table. Thank you.
Upvotes: 8
Views: 8977
Reputation: 280431
You can get this from the catalog view in the master
database:
USE master;
GO
SELECT name, OBJECT_DEFINITION ([object_id])
FROM sys.server_triggers
-- WHERE name = N'trg_LogonAttempt'
;
You can also script it through the UI, as @Michael pointed out - server-level triggers are stored under Instance > Server Objects > Triggers:
Upvotes: 15