SQL Server 2012:“所有服务器”在哪里?触发存储的脚本 [英] SQL server 2012: Where are the "ALL SERVER" triggers scripts stored
问题描述
如果我在触发器 ALL SERVER上创建了触发器,该触发器将存储在哪里。
Where would a trigger be stored if I created it to trigger on "ALL SERVER".
在所有服务器
上创建触发trg_LogonAttempt登录
AS
开始
如果ORIGINAL_LOGIN()='dbo'
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.
推荐答案
您可以从 master
数据库的目录视图中获取:
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'
;
您也可以通过UI编写脚本,就像@Michael指出的那样-存储服务器级触发器在实例>服务器对象>触发器下:
You can also script it through the UI, as @Michael pointed out - server-level triggers are stored under Instance > Server Objects > Triggers:
这篇关于SQL Server 2012:“所有服务器”在哪里?触发存储的脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!