SQL server 2012: Where are the “ALL SERVER” triggers scripts stored

旧街凉风 提交于 2019-12-22 07:08:29

问题


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.


回答1:


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:



来源:https://stackoverflow.com/questions/20404097/sql-server-2012-where-are-the-all-server-triggers-scripts-stored

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!