AFTER 触发器语法:
1 CREATE [ OR ALTER ] TRIGGER [ schema_name . ]trigger_name 2 ON { table } 3 [ WITH <dml_trigger_option> [ ,...n ] ] 4 { FOR | AFTER } 5 { [ INSERT ] [ , ] [ UPDATE ] [ , ] [ DELETE ] } 6 AS { sql_statement [ ; ] [ ,...n ] } 7 8 <dml_trigger_option> ::= 9 [ NATIVE_COMPILATION ] 10 [ SCHEMABINDING ] 11 [ EXECUTE AS Clause ]
INSTEAD OF 触发器语法:
1 CREATE [ OR ALTER ] TRIGGER [ schema_name . ]trigger_name 2 ON { table | view } 3 [ WITH <dml_trigger_option> [ ,...n ] ] 4 { FOR | AFTER | INSTEAD OF } 5 { [ INSERT ] [ , ] [ UPDATE ] [ , ] [ DELETE ] } 6 [ WITH APPEND ] 7 [ NOT FOR REPLICATION ] 8 AS { sql_statement [ ; ] [ ,...n ] | EXTERNAL NAME <method specifier [ ; ] > } 9 10 <dml_trigger_option> ::= 11 [ ENCRYPTION ] 12 [ EXECUTE AS Clause ] 13 14 <method_specifier> ::= 15 assembly_name.class_name.method_name
DDL 触发器语法:
1 CREATE [ OR ALTER ] TRIGGER trigger_name 2 ON { ALL SERVER | DATABASE } 3 [ WITH <ddl_trigger_option> [ ,...n ] ] 4 { FOR | AFTER } { event_type | event_group } [ ,...n ] 5 AS { sql_statement [ ; ] [ ,...n ] | EXTERNAL NAME < method specifier > [ ; ] } 6 7 <ddl_trigger_option> ::= 8 [ ENCRYPTION ] 9 [ EXECUTE AS Clause ]
登陆触发器语法:
1 CREATE [ OR ALTER ] TRIGGER trigger_name 2 ON ALL SERVER 3 [ WITH <logon_trigger_option> [ ,...n ] ] 4 { FOR| AFTER } LOGON 5 AS { sql_statement [ ; ] [ ,...n ] | EXTERNAL NAME < method specifier > [ ; ] } 6 7 <logon_trigger_option> ::= 8 [ ENCRYPTION ] 9 [ EXECUTE AS Clause ]