篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql MS SQL触发器语法相关的知识,希望对你有一定的参考价值。
-- DML TRIGGER
-- Trigger on an INSERT, UPDATE, or DELETE
CREATE|ALTER TRIGGER [schema_name.]trigger_name
ON table|view
[WITH ENCRYPTION|SCHEMABINDING|EXECUTE AS Clause]
FOR|AFTER|INSTEAD OF
INSERT[,]|UPDATE[,]|DELETE
[WITH APPEND]
[NOT FOR REPLICATION]
AS
sql_statement [ ; ] [ ,...n ] |
EXTERNAL NAME assembly_name.class_name.method_name
-- DDL TRIGGER
-- Trigger on a CREATE, ALTER, DROP, GRANT,
-- DENY, REVOKE or UPDATE
CREATE|ALTER TRIGGER trigger_name
ON ALL SERVER | DATABASE
[WITH ENCRYPTION|EXECUTE AS Clause]
FOR|AFTER
event_type|event_group
[ ,...n ]
AS
sql_statement [ ; ] [ ,...n ] |
EXTERNAL NAME assembly_name.class_name.method_name
-- LOGON TRIGGER
CREATE|ALTER TRIGGER trigger_name
ON ALL SERVER
[WITH ENCRYPTION|EXECUTE AS Clause]
FOR|AFTER
LOGON
AS
sql_statement [ ; ] [ ,...n ] |
EXTERNAL NAME assembly_name.class_name.method_name