Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我在 SQL Server 2008 中创建一个同时触发 DROP_TABLE 和 ALTER_TABLE 的数据库触发器,我如何确定这是 DROP 还是 ALTER?
在触发器内部,您可以测试
SELECT EVENTDATA().value('(/EVENT_INSTANCE/EventType)[1]','sysname')
这将是DROP_TABLE或ALTER_TABLE
DROP_TABLE
ALTER_TABLE
文档EVENTDATA
EVENTDATA