Eventi DDLDDL Events

Nelle tabelle seguenti sono elencati gli eventi DDL che possono essere utilizzati per attivare un trigger DDL o generare una notifica degli eventi.The following tables list the DDL events that can be used to fire a DDL trigger or event notification. Si noti che ogni evento corrisponde a una stored procedure o un'istruzione Transact-SQLTransact-SQL , con la sintassi modificata per includere un carattere di sottolineatura () fra le parole chiave.Note that each event corresponds to a Transact-SQLTransact-SQL statement or stored procedure, with the statement syntax modified to include an underscore character () between keywords.

Importante

Le stored procedure di sistema che eseguono operazioni di tipo DDL possono inoltre generare trigger DDL e notifiche degli eventi.System stored procedures that perform DDL-like operations also fire DDL triggers and event notifications. Testare i trigger DDL e le notifiche degli eventi per determinarne la risposta alle stored procedure di sistema eseguite.Test your DDL triggers and event notifications to determine their responses to system stored procedures that are run. Ad esempio, l'istruzione CREATE TYPE e la stored procedure sp_addtype consentono entrambe di attivare un trigger DDL o una notifica degli eventi creata in un evento CREATE_TYPE.For example, the CREATE TYPE statement and sp_addtype stored procedure will both fire a DDL trigger or event notification that is created on a CREATE_TYPE event.

Istruzioni DDL di ambito server o databaseDDL Statements That Have Server or Database Scope

È possibile creare le notifiche degli eventi o i trigger DDL in modo che vengano attivati in risposta agli eventi seguenti, qualora questi ultimi si verifichino nel database in cui la notifica degli eventi o il trigger è stato creato oppure in qualsiasi punto dell'istanza server.DDL triggers or event notifications can be created to fire in response to the following events when they occur in the database in which the trigger or event notification is created, or anywhere in the server instance.

CREATE_APPLICATION_ROLE (si applica all'istruzione CREATE APPLICATION ROLE e sp_addapprole.CREATE_APPLICATION_ROLE (Applies to the CREATE APPLICATION ROLE statement and sp_addapprole. Se viene creato un nuovo schema, questo evento attiva anche un evento CREATE_SCHEMA).If a new schema is created, this event also triggers a CREATE_SCHEMA event.) ALTER_APPLICATION_ROLE (si applica all'istruzione ALTER APPLICATION ROLE e sp_approlepassword).ALTER_APPLICATION_ROLE (Applies to the ALTER APPLICATION ROLE statement and sp_approlepassword.) DROP_APPLICATION_ROLE (si applica all'istruzione DROP APPLICATION ROLE e sp_dropapprole).DROP_APPLICATION_ROLE (Applies to the DROP APPLICATION ROLE statement and sp_dropapprole.)
CREATE_ASSEMBLYCREATE_ASSEMBLY ALTER_ASSEMBLYALTER_ASSEMBLY DROP_ASSEMBLYDROP_ASSEMBLY
CREATE_ASYMMETRIC_KEYCREATE_ASYMMETRIC_KEY ALTER_ASYMMETRIC_KEYALTER_ASYMMETRIC_KEY DROP_ASYMMETRIC_KEYDROP_ASYMMETRIC_KEY
ALTER_AUTHORIZATIONALTER_AUTHORIZATION ALTER_AUTHORIZATION_DATABASE (si applica all'istruzione ALTER AUTHORIZATION, quando è specificato ON DATABASE, e a sp_changedbowner).ALTER_AUTHORIZATION_DATABASE (Applies to the ALTER AUTHORIZATION statement when ON DATABASE is specified, and sp_changedbowner.)
CREATE_BROKER_PRIORITYCREATE_BROKER_PRIORITY CREATE_BROKER_PRIORITYCREATE_BROKER_PRIORITY CREATE_BROKER_PRIORITYCREATE_BROKER_PRIORITY
CREATE_CERTIFICATECREATE_CERTIFICATE ALTER_CERTIFICATEALTER_CERTIFICATE DROP_CERTIFICATEDROP_CERTIFICATE
CREATE_CONTRACTCREATE_CONTRACT DROP_CONTRACTDROP_CONTRACT
CREATE_CREDENTIALCREATE_CREDENTIAL ALTER_CREDENTIALALTER_CREDENTIAL DROP_CREDENTIALDROP_CREDENTIAL
GRANT_DATABASEGRANT_DATABASE DENY_DATABASEDENY_DATABASE REVOKE_DATABASEREVOKE_DATABASE
CREATE_DATABASE_AUDIT_SPEFICIATIONCREATE_DATABASE_AUDIT_SPEFICIATION ALTER_DATABASE_AUDIT_SPEFICIATIONALTER_DATABASE_AUDIT_SPEFICIATION DENY_DATABASE_AUDIT_SPEFICIATIONDENY_DATABASE_AUDIT_SPEFICIATION
CREATE_DATABASE_ENCRYPTION_KEYCREATE_DATABASE_ENCRYPTION_KEY ALTER_DATABASE_ENCRYPTION_KEYALTER_DATABASE_ENCRYPTION_KEY DROP_DATABASE_ENCRYPTION_KEYDROP_DATABASE_ENCRYPTION_KEY
CREATE_DEFAULTCREATE_DEFAULT DROP_DEFAULTDROP_DEFAULT
BIND_DEFAULT (si applica a sp_bindefault).BIND_DEFAULT (Applies to sp_bindefault.) UNBIND_DEFAULT (si applica a sp_unbindefault).UNBIND_DEFAULT (Applies to sp_unbindefault.)
CREATE_EVENT_NOTIFICATIONCREATE_EVENT_NOTIFICATION DROP_EVENT_NOTIFICATIONDROP_EVENT_NOTIFICATION
CREATE_EXTENDED_PROPERTY (si applica a sp_addextendedproperty).CREATE_EXTENDED_PROPERTY (Applies to sp_addextendedproperty.) ALTER_EXTENDED_PROPERTY (si applica a sp_updateextendedproperty).ALTER_EXTENDED_PROPERTY (Applies to sp_updateextendedproperty.) DROP_EXTENDED_PROPERTY (si applica a sp_dropextendedproperty).DROP_EXTENDED_PROPERTY (Applies to sp_dropextendedproperty.)
CREATE_FULLTEXT_CATALOG (si applica all'istruzione CREATE FULLTEXT CATALOG e sp_fulltextcatalog quando create è specificato).CREATE_FULLTEXT_CATALOG (Applies to the CREATE FULLTEXT CATALOG statement and sp_fulltextcatalog when create is specified.) ALTER_FULLTEXT_CATALOG (si applica all'istruzione ALTER FULLTEXT CATALOG, sp_fulltextcatalog quando è specificato start_incremental, start_full, Stopoppure Rebuild e sp_fulltext_database quando è specificato enable ).ALTER_FULLTEXT_CATALOG (Applies to the ALTER FULLTEXT CATALOG statement, sp_fulltextcatalog when start_incremental, start_full, Stop, or Rebuild is specified, and sp_fulltext_database when enable is specified.) DROP_FULLTEXT_CATALOG (si applica all'istruzione DROP FULLTEXT CATALOG e a sp_fulltextcatalog quando drop è specificato).DROP_FULLTEXT_CATALOG (Applies to the DROP FULLTEXT CATALOG statement and sp_fulltextcatalog when drop is specified.)
CREATE_FULLTEXT_INDEX (si applica all'istruzione CREATE FULLTEXT INDEX e a sp_fulltexttable quando create è specificato).CREATE_FULLTEXT_INDEX (Applies to the CREATE FULLTEXT INDEX statement and sp_fulltexttable when create is specified.) ALTER_FULLTEXT_INDEX (si applica all'istruzione ALTER FULLTEXT INDEX, sp_fulltextcatalog quando è specificato start_full, start_incrementaloppure stop , sp_fulltext_columne sp_fulltext_table quando è specificata qualunque azione diversa da create o drop ).ALTER_FULLTEXT_INDEX (Applies to the ALTER FULLTEXT INDEX statement, sp_fulltextcatalog when start_full, start_incremental, or stop is specified, sp_fulltext_column, and sp_fulltext_table when any action other than create or drop is specified.) DROP_FULLTEXT_INDEX (si applica all'istruzione DROP FULLTEXT INDEX e a sp_fulltexttable quando drop è specificato).DROP_FULLTEXT_INDEX (Applies to the DROP FULLTEXT INDEX statement and sp_fulltexttable when drop is specified.)
CREATE_FULLTEXT_STOPLISTCREATE_FULLTEXT_STOPLIST ALTER_FULLTEXT_STOPLISTALTER_FULLTEXT_STOPLIST DROP_FULLTEXT_STOPLISTDROP_FULLTEXT_STOPLIST
CREATE_FUNCTIONCREATE_FUNCTION ALTER_FUNCTIONALTER_FUNCTION DROP_FUNCTIONDROP_FUNCTION
CREATE_INDEXCREATE_INDEX ALTER_INDEX (si applica all'istruzione ALTER INDEX e a sp_indexoption).ALTER_INDEX (Applies to the ALTER INDEX statement and sp_indexoption.) DROP_INDEXDROP_INDEX
CREATE_MASTER_KEYCREATE_MASTER_KEY ALTER_MASTER_KEYALTER_MASTER_KEY DROP_MASTER_KEYDROP_MASTER_KEY
CREATE_MESSAGE_TYPECREATE_MESSAGE_TYPE ALTER_MESSAGE_TYPEALTER_MESSAGE_TYPE DROP_MESSAGE_TYPEDROP_MESSAGE_TYPE
CREATE_PARTITION_FUNCTIONCREATE_PARTITION_FUNCTION ALTER_PARTITION_FUNCTIONALTER_PARTITION_FUNCTION DROP_PARTITION_FUNCTIONDROP_PARTITION_FUNCTION
CREATE_PARTITION_SCHEMECREATE_PARTITION_SCHEME ALTER_PARTITION_SCHEMEALTER_PARTITION_SCHEME DROP_PARTITION_SCHEMEDROP_PARTITION_SCHEME
CREATE_PLAN_GUIDE (si applica a sp_create_plan_guide).CREATE_PLAN_GUIDE (Applies to sp_create_plan_guide.) ALTER_PLAN_GUIDE (si applica a sp_control_plan_guide quando è specificato ENABLE, ENABLE ALL, DISABLE o DISABLE ALL).ALTER_PLAN_GUIDE (Applies to sp_control_plan_guide when ENABLE, ENABLE ALL, DISABLE, or DISABLE ALL is specified.) DROP_PLAN_GUIDE (si applica a sp_control_plan_guide quando è specificato DROP o DROP ALL).DROP_PLAN_GUIDE (Applies to sp_control_plan_guide when DROP or DROP ALL is specified.)
CREATE_PROCEDURECREATE_PROCEDURE ALTER_PROCEDURE (si applica all'istruzione ALTER PROCEDURE e a sp_procoption).ALTER_PROCEDURE (Applies to the ALTER PROCEDURE statement and sp_procoption.) DROP_PROCEDUREDROP_PROCEDURE
CREATE_QUEUECREATE_QUEUE ALTER_QUEUEALTER_QUEUE DROP_QUEUEDROP_QUEUE
CREATE_REMOTE_SERVICE_BINDINGCREATE_REMOTE_SERVICE_BINDING ALTER_REMOTE_SERVICE_BINDINGALTER_REMOTE_SERVICE_BINDING DROP_REMOTE_SERVICE_BINDINGDROP_REMOTE_SERVICE_BINDING
CREATE_SPATIAL_INDEXCREATE_SPATIAL_INDEX
RENAME (si applica a sp_rename)RENAME (Applies to sp_rename)
CREATE_ROLE (si applica all'istruzione CREATE ROLE, sp_addrolee sp_addgroup).CREATE_ROLE (Applies to the CREATE ROLE statement, sp_addrole, and sp_addgroup.) ALTER_ROLEALTER_ROLE DROP_ROLE (si applica all'istruzione DROP ROLE, sp_droprolee sp_dropgroup).DROP_ROLE (Applies to the DROP ROLE statement, sp_droprole, and sp_dropgroup.)
ADD_ROLE_MEMBERADD_ROLE_MEMBER DROP_ROLE_MEMBERDROP_ROLE_MEMBER
CREATE_ROUTECREATE_ROUTE ALTER_ROUTEALTER_ROUTE DROP_ROUTEDROP_ROUTE
CREATE_RULECREATE_RULE DROP_RULEDROP_RULE
BIND_RULE (si applica a sp_bindrule).BIND_RULE (Applies to sp_bindrule.) UNBIND_RULE (si applica a sp_unbindrule).UNBIND_RULE (Applies to sp_unbindrule.)
CREATE_SCHEMA (si applica all'istruzione CREATE SCHEMA, sp_addrole, sp_adduser, sp_addgroupe sp_grantdbaccess).CREATE_SCHEMA (Applies to the CREATE SCHEMA statement, sp_addrole, sp_adduser, sp_addgroup, and sp_grantdbaccess.) ALTER_SCHEMA (si applica all'istruzione ALTER SCHEMA e sp_changeobjectowner).ALTER_SCHEMA (Applies to the ALTER SCHEMA statement and sp_changeobjectowner.) DROP_SCHEMADROP_SCHEMA
CREATE_SEARCH_PROPERTY_LISTCREATE_SEARCH_PROPERTY_LIST ALTER_SEARCH_PROPERTY_LISTALTER_SEARCH_PROPERTY_LIST DROP_SEARCH_PROPERTY_LISTDROP_SEARCH_PROPERTY_LIST
CREATE_SEQUENCE_EVENTSCREATE_SEQUENCE_EVENTS CREATE_SEQUENCE_EVENTSCREATE_SEQUENCE_EVENTS CREATE_SEQUENCE_EVENTSCREATE_SEQUENCE_EVENTS
CREATE_SERVER_ROLECREATE_SERVER_ROLE ALTER_SERVER_ROLEALTER_SERVER_ROLE DROP_SERVER_ROLEDROP_SERVER_ROLE
CREATE_SERVICECREATE_SERVICE ALTER_SERVICEALTER_SERVICE DROP_SERVICEDROP_SERVICE
ALTER_SERVICE_MASTER_KEYALTER_SERVICE_MASTER_KEY BACKUP_SERVICE_MASTER_KEYBACKUP_SERVICE_MASTER_KEY RESTORE_SERVICE_MASTER_KEYRESTORE_SERVICE_MASTER_KEY
ADD_SIGNATURE (per operazioni di firma su oggetti con ambito non schema, cioè database, assembly, trigger)ADD_SIGNATURE (for signature operations on non-schema scoped objects; database, assembly, trigger) DROP_SIGNATUREDROP_SIGNATURE
ADD_SIGNATURE_SCHEMA_OBJECT (per oggetti con ambito schema, cioè stored procedure, funzioni)ADD_SIGNATURE_SCHEMA_OBJECT (for schema scoped objects; stored procedures, functions) DROP_SIGNATURE_SCHEMA_OBJECTDROP_SIGNATURE_SCHEMA_OBJECT
CREATE_SPATIAL_INDEXCREATE_SPATIAL_INDEX ALTER_INDEX può essere utilizzato per gli indici spaziali.ALTER_INDEX can be used for spatial indexes. DROP_INDEX può essere usato per gli indici spaziali.DROP_INDEX can be used for spatial indexes.
CREATE_STATISTICSCREATE_STATISTICS DROP_STATISTICSDROP_STATISTICS UPDATE_STATISTICSUPDATE_STATISTICS
CREATE_SYMMETRIC_KEYCREATE_SYMMETRIC_KEY ALTER_SYMMETRIC_KEYALTER_SYMMETRIC_KEY DROP_SYMMETRIC_KEYDROP_SYMMETRIC_KEY
CREATE_SYNONYMCREATE_SYNONYM DROP_SYNONYMDROP_SYNONYM
CREATE_TABLECREATE_TABLE ALTER_TABLE (si applica all'istruzione ALTER TABLE e sp_tableoption).ALTER_TABLE (Applies to the ALTER TABLE statement and sp_tableoption.) DROP_TABLEDROP_TABLE
CREATE_TRIGGERCREATE_TRIGGER ALTER_TRIGGER (si applica all'istruzione ALTER TRIGGER e sp_settriggerorder).ALTER_TRIGGER (Applies to the ALTER TRIGGER statement and sp_settriggerorder.) DROP_TRIGGERDROP_TRIGGER
CREATE_TYPE (si applica all'istruzione CREATE TYPE e sp_addtype).CREATE_TYPE (Applies to the CREATE TYPE statement and sp_addtype.) DROP_TYPE (si applica all'istruzione DROP TYPE e sp_droptype).DROP_TYPE (Applies to the DROP TYPE statement and sp_droptype.)
CREATE_USER (si applica all'istruzione CREATE USER, sp_addusere sp_grantdbaccess).CREATE_USER (Applies to the CREATE USER statement, sp_adduser, and sp_grantdbaccess.) ALTER_USER (si applica all'istruzione ALTER USER e sp_change_user_login).ALTER_USER (Applies to ALTER USER statement and sp_change_users_login.) DROP_USER (si applica all'istruzione DROP USER, sp_dropusere sp_revokedbaccess).DROP_USER (Applies to the DROP USER statement, sp_dropuser, and sp_revokedbaccess.)
CREATE_VIEWCREATE_VIEW ALTER_VIEWALTER_VIEW DROP_VIEWDROP_VIEW
CREATE_XML_INDEXCREATE_XML_INDEX ALTER_INDEX può essere utilizzato per gli indici XML.ALTER_INDEX can be used for XML indexes. DROP_INDEX può essere usato per gli indici XML.DROP_INDEX can be used for XML indexes.
CREATE_XML_SCHEMA_COLLECTIONCREATE_XML_SCHEMA_COLLECTION ALTER_XML_SCHEMA_COLLECTIONALTER_XML_SCHEMA_COLLECTION DROP_XML_SCHEMA_COLLECTIONDROP_XML_SCHEMA_COLLECTION

Istruzioni DDL di ambito serverDDL Statements That Have Server Scope

È possibile creare le notifiche degli eventi o i trigger DDL in modo che vengano attivati in risposta agli eventi seguenti, qualora questi ultimi si verifichino in qualsiasi punto dell'istanza del server.DDL triggers or event notifications can be created to fire in response to the following events when they occur anywhere in the server instance.

ALTER_AUTHORIZATION_SERVERALTER_AUTHORIZATION_SERVER ALTER_SERVER_CONFIGURATIONALTER_SERVER_CONFIGURATION ALTER_INSTANCE (si applica a sp_configure e sp_addserver quando è specificata un'istanza del server locale).ALTER_INSTANCE (Applies to sp_configure and sp_addserver when a local server instance is specified.)
CREATE_AVAILABILITY_GROUPCREATE_AVAILABILITY_GROUP ALTER_AVAILABILITY_GROUPALTER_AVAILABILITY_GROUP DROP_AVAILABILITY_GROUPDROP_AVAILABILITY_GROUP
CREATE_CREDENTIALCREATE_CREDENTIAL ALTER_CREDENTIALALTER_CREDENTIAL DROP_CREDENTIALDROP_CREDENTIAL
CREATE_CRYPTOGRAPHIC_PROVIDERCREATE_CRYPTOGRAPHIC_PROVIDER ALTER_CRYPTOGRAPHIC_PROVIDERALTER_CRYPTOGRAPHIC_PROVIDER DROP_CRYPTOGRAPHIC_PROVIDERDROP_CRYPTOGRAPHIC_PROVIDER
CREATE_DATABASECREATE_DATABASE ALTER_DATABASE (si applica all'istruzione ALTER DATABASE e a sp_fulltext_database).ALTER_DATABASE (Applies to the ALTER DATABASE statement and sp_fulltext_database.) DROP_DATABASEDROP_DATABASE
CREATE_ENDPOINTCREATE_ENDPOINT ALTER_ENDPOINTALTER_ENDPOINT DROP_ENDPOINTDROP_ENDPOINT
CREATE_EVENT_SESSIONCREATE_EVENT_SESSION ALTER_EVENT_SESSIONALTER_EVENT_SESSION DROP_EVENT_SESSIONDROP_EVENT_SESSION
CREATE_EXTENDED_PROCEDURE (si applica a sp_addextendedproc).CREATE_EXTENDED_PROCEDURE (Applies to sp_addextendedproc.) DROP_EXTENDED_PROCEDURE (si applica a sp_dropextendedproc).DROP_EXTENDED_PROCEDURE (Applies to sp_dropextendedproc.)
CREATE_LINKED_SERVER (si applica a sp_addlinkedserver).CREATE_LINKED_SERVER (Applies to sp_addlinkedserver.) ALTER_LINKED_SERVER (si applica a sp_serveroption).ALTER_LINKED_SERVER (Applies to sp_serveroption.) DROP_LINKED_SERVER (si applica a sp_dropserver quando è specificato un server collegato).DROP_LINKED_SERVER (Applies to sp_dropserver when a linked server is specified.)
CREATE_LINKED_SERVER_LOGIN (si applica a sp_addlinkedsrvlogin).CREATE_LINKED_SERVER_LOGIN (Applies to sp_addlinkedsrvlogin.) DROP_LINKED_SERVER_LOGIN (si applica a sp_droplinkedsrvlogin).DROP_LINKED_SERVER_LOGIN (Applies to sp_droplinkedsrvlogin.)
CREATE_LOGIN (si applica all'istruzione CREATE LOGIN, sp_addlogin, sp_grantlogin, xp_grantlogine sp_denylogin quando vengono usati su un account di accesso che deve essere creato implicitamente).CREATE_LOGIN (Applies to the CREATE LOGIN statement, sp_addlogin, sp_grantlogin, xp_grantlogin, and sp_denylogin when used on a nonexistent login that must be implicitly created.) ALTER_LOGIN (si applica all'istruzione ALTER LOGIN, sp_defaultdb, sp_defaultlanguage, sp_passworde sp_change_users_login quando si specifica Auto_Fix ).ALTER_LOGIN (Applies to the ALTER LOGIN statement, sp_defaultdb, sp_defaultlanguage, sp_password, and sp_change_users_login when Auto_Fix is specified.) DROP_LOGIN (si applica all'istruzione DROP LOGIN, sp_droplogin, sp_revokelogine xp_revokelogin).DROP_LOGIN (Applies to the DROP LOGIN statement, sp_droplogin, sp_revokelogin, and xp_revokelogin.)
CREATE_MESSAGE (si applica a sp_addmessage).CREATE_MESSAGE (Applies to sp_addmessage.) ALTER_MESSAGE (si applica a sp_altermessage).ALTER_MESSAGE (Applies to sp_altermessage.) DROP_MESSAGE (si applica a sp_dropmessage).DROP_MESSAGE (Applies to sp_dropmessage.)
CREATE_REMOTE_SERVER (si applica a sp_addserver).CREATE_REMOTE_SERVER (Applies to sp_addserver.) ALTER_REMOTE_SERVER (si applica a sp_setnetname).ALTER_REMOTE_SERVER (Applies to sp_setnetname.) DROP_REMOTE_SERVER (si applica a sp_dropserver quando è specificato un server remoto).DROP_REMOTE_SERVER (Applies to sp_dropserver when a remote server is specified.)
CREATE_RESOURCE_POOLCREATE_RESOURCE_POOL ALTER_RESOURCE_POOLALTER_RESOURCE_POOL DROP_RESOURCE_POOLDROP_RESOURCE_POOL
GRANT_SERVERGRANT_SERVER DENY_SERVERDENY_SERVER REVOKE_SERVERREVOKE_SERVER
ADD_SERVER_ROLE_MEMBERADD_SERVER_ROLE_MEMBER DROP_SERVER_ROLE_MEMBERDROP_SERVER_ROLE_MEMBER
CREATE_SERVER_AUDITCREATE_SERVER_AUDIT ALTER_SERVER_AUDITALTER_SERVER_AUDIT DROP_SERVER_AUDITDROP_SERVER_AUDIT
CREATE_SERVER_AUDIT_SPECIFICATIONCREATE_SERVER_AUDIT_SPECIFICATION ALTER_SERVER_AUDIT_SPECIFICATIONALTER_SERVER_AUDIT_SPECIFICATION DROP_SERVER_AUDIT_SPECIFICATIONDROP_SERVER_AUDIT_SPECIFICATION
CREATE_WORKLOAD_GROUPCREATE_WORKLOAD_GROUP ALTER_WORKLOAD_GROUPALTER_WORKLOAD_GROUP DROP_WORKLOAD_GROUPDROP_WORKLOAD_GROUP

Vedere ancheSee Also

Trigger DDL DDL Triggers
Notifiche degli eventi Event Notifications
Gruppi di eventi DDL DDL Event Groups