Skip to Main Content
SQL in a Nutshell
book

SQL in a Nutshell

by Kevin Kline
December 2000
Intermediate to advanced content levelIntermediate to advanced
224 pages
9h 52m
English
O'Reilly Media, Inc.
Content preview from SQL in a Nutshell

Name

ALTER TRIGGER

Synopsis

The ALTER TRIGGER statement modifies a preexisting trigger definition without altering permissions or dependencies.

Vendor

Command

SQL Server

Supported, with variations

MySQL

Not supported

Oracle

Supported, with variations

PostgreSQL

Not supported

SQL99 Syntax and Description

Currently, there is no SQL99 standard for this command.

Microsoft SQL Server Syntax and Variations

ALTER TRIGGER trigger_name
ON {table_name | view_name}
[WITH ENCRYPTION]
{FOR | AFTER | INSTEAD OF} {[DELETE] [,] [INSERT] [,] [UPDATE]}
[WITH APPEND]
[NOT FOR REPLICATION]
AS
  T-SQL_block
| [FOR { [INSERT] [,] [UPDATE] }
[NOT FOR REPLICATION]
AS
 
  { IF UPDATE(column) [{AND | OR} UPDATE(column)] [...n]
    | 
    IF (COLUMNS_UPDATED(  ) {bitwise_operator} updated_bitmask) 
    { comparison_operator} column_bitmask [...n] }
    T-SQL_block ] } ]

Microsoft SQL Server allows the specification of FOR | AFTER | INSTEAD OF { [DELETE] [,] [UPDATE] [,][INSERT] } | { [INSERT] [,] [UPDATE] } to describe which data-modification statement trigger is affected by the command. At least one of these is required, but any combination is allowed with extra options separated by commas. The options FOR and AFTER are essentially the same, causing the trigger code to fire after the data-manipulation operation has completed. Alternately, the INSTEAD OF key phrase tells SQL Server to substitute the data-manipulation operation completely with the code of the trigger.

The WITH APPEND key phrase tells SQL Server to append an ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SQL in a Nutshell, 3rd Edition

SQL in a Nutshell, 3rd Edition

Kevin Kline

Publisher Resources

ISBN: 1565927443