我查看了这些线程,尽管它们相似,但它们无法回答我的问题。
Can't see the triggers that I created in SQL Server Management Studio 2008
Unable to find where triggers are stored in sql server 2008
Where does a Server trigger save in SQL Server?
在SSMS 17.9.1(SQL Server 2017)中,使用此代码时可以看到触发器存在
select * from FocalAreas.sys.triggers
我还可以在SharingPermissionTest(我想要触发器的表)上看到> View Dependencies,触发器就在那里。但是,当我展开SharingPermissionTest触发器文件夹时,那里什么也没有。当我在数据库上展开“可编程性”>“数据库触发器”时,那里什么也没有。当我展开“服务器对象”>“触发器”时,那里什么也没有。有人对正在发生的事情有任何见解吗?这是我创建触发器的SQL:
USE FocalAreas
GO
CREATE TRIGGER dbo.SharingPermissionsTrigger
ON FocalAreas.dbo.FOCALREFERENCEAREAS
AFTER INSERT
AS BEGIN
DECLARE @FocalRefID nvarchar(50)
DECLARE @StateID nvarchar(2)
SELECT @FocalRefID = i.FocalRefID
FROM Inserted i
WHERE 1=1
SELECT @StateID = mp.StateID
FROM Inserted i, FocalAreas.dbo.MonitoringPoint as mp
WHERE i.FocalRefID = mp.FocalRefID
INSERT INTO FocalAreas.dbo.SharingPermissionsTest
Values
(next value for SharingPermissionSequence, @FocalRefID, 'NBTC', @StateID,
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed',
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed',
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed'
,'Not Allowed'),
(next value for SharingPermissionSequence, @FocalRefID, 'StateWildlifeAgency', @StateID,
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed',
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed',
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed'
,'Not Allowed'),
(next value for SharingPermissionSequence, @FocalRefID, 'FedPartners', @StateID,
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed',
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed',
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed'
,'Not Allowed'),
(next value for SharingPermissionSequence, @FocalRefID, 'NGO', @StateID,
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed',
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed',
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed'
,'Not Allowed'),
(next value for SharingPermissionSequence, @FocalRefID, 'Public', @StateID,
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed',
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed',
'Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed','Not Allowed'
,'Not Allowed')
END
GO
答案 0 :(得分:0)
展开表FocalAreas.dbo.FOCALREFERENCEAREAS
的树,右键单击“触发器”节点/文件夹,单击“刷新”,然后展开“触发器”树。触发器应该在那里。
顺便说一下,这是您发布的第一个链接中的解决方案,但是在问题文本中,您没有正确描述遵循此解决方案。您提到“当我展开SharingPermissionTest触发器文件夹时,那里什么也没有。”但是您永远不会提及在触发器所在的实际表下查找,这就是链接问题中的答案告诉您要做的事情。