SALES: 1-800-867-1380
This topic has not yet been rated - Rate this topic

CREATE TRIGGER (Azure SQL Database)

This topic is OBSOLETE. You can find the most current version in the SQL 14 Transact-SQL Reference.

ImportantImportant
This topic is not maintained. For the current version, see CREATE TRIGGER (Transact-SQL).

Creates a data manipulation language (DML) or data definition language (DDL) trigger. A trigger is a special kind of stored procedure that automatically executes when an event occurs in the database server.

Syntax Conventions (Azure SQL Database)

Trigger on an INSERT, UPDATE, or DELETE statement to a table or view (DML Trigger)
CREATE TRIGGER [ schema_name . ]trigger_name 
ON { table | view } 
[ WITH <dml_trigger_option> [ ,...n ] ]
{ FOR | AFTER | INSTEAD OF } 
{ [ INSERT ] [ , ] [ UPDATE ] [ , ] [ DELETE ] } 
  AS { sql_statement  [ ; ] [ ,...n ] [ ; ] > }

<dml_trigger_option> ::=
        [ EXECUTE AS Clause ]


Trigger on a CREATE, ALTER, DROP, GRANT, DENY, REVOKE, or UPDATE STATISTICS statement (DDL Trigger)
CREATE TRIGGER trigger_name 
ON { DATABASE } 
[ WITH <ddl_trigger_option> [ ,...n ] ]
{ FOR | AFTER } { event_type | event_group } [ ,...n ]
AS { sql_statement  [ ; ] [ ,...n ]  [ ; ] }

<ddl_trigger_option> ::=
    [ EXECUTE AS Clause ]



This syntax diagram demonstrates the supported arguments and options in Microsoft Windows Azure SQL Database.

Windows Azure SQL Database does not support the following arguments and options with the CREATE TRIGGER statement:

  • ENCRYPTION

  • WITH APPEND

  • NOT FOR REPLICATION

  • EXTERNAL NAME option (there is no external method support)

  • ALL SERVER Option (DDL Trigger)

  • Trigger on a LOGON event (Logon Trigger)

For more information about the arguments and the CREATE TRIGGER statement, see CREATE TRIGGER (Transact-SQL) in SQL Server Books Online.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.