sp_helptrigger (Transact-SQL)sp_helptrigger (Transact-SQL)

适用于: 是SQL Server是Azure SQL 数据库否Azure SQL 数据仓库否并行数据仓库APPLIES TO: yesSQL Server yesAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

返回对当前数据库的指定表定义的 DML 触发器的类型。Returns the type or types of DML triggers defined on the specified table for the current database. sp_helptrigger 不能用于 DDL 触发器。sp_helptrigger cannot be used with DDL triggers. 查询系统存储过程目录视图。Query the system stored procedures catalog view instead.

主题链接图标 TRANSACT-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

  
sp_helptrigger [ @tabname = ] 'table'   
     [ , [ @triggertype = ] 'type' ]  

参数Arguments

[ @tabname = ] 'table' 是要为其返回触发器信息的当前数据库中的名称。[ @tabname = ] 'table' Is the name of the table in the current database for which to return trigger information. nvarchar(776) ,无默认值。table is nvarchar(776), with no default.

[ @triggertype = ] 'type' 是要返回其信息的 DML 触发器的类型。[ @triggertype = ] 'type' Is the type of DML trigger to return information about. 类型char(6) ,默认值为 NULL,并且可以是下列值之一。type is char(6), with a default of NULL, and can be one of these values.

Value 描述Description
DELETEDELETE 返回 DELETE 触发器信息。Returns DELETE trigger information.
INSERTINSERT 返回 INSERT 触发器信息。Returns INSERT trigger information.
UPDATEUPDATE 返回 UPDATE 触发器信息。Returns UPDATE trigger information.

返回代码值Return Code Values

0(成功)或 1(失败)0 (success) or 1 (failure)

结果集Result Sets

下表显示了结果集中包含的信息。The following table shows the information that is contained in the result set.

列名Column name 数据类型Data type 描述Description
trigger_nametrigger_name sysnamesysname 触发器的名称。Name of the trigger.
trigger_ownertrigger_owner sysnamesysname 对其定义触发器的表的所有者名称。Name of the owner of the table on which the trigger is defined.
isupdateisupdate intint 1=UPDATE 触发器1=UPDATE trigger

0=不是 UPDATE 触发器0=Not an UPDATE trigger
isdeleteisdelete intint 1=DELETE 触发器1=DELETE trigger

0=不是 DELETE 触发器0=Not a DELETE trigger
isinsertisinsert intint 1=INSERT 触发器1=INSERT trigger

0=不是 INSERT 触发器0=Not an INSERT trigger
isafterisafter intint 1=AFTER 触发器1=AFTER trigger

0=不是 AFTER 触发器0=Not an AFTER trigger
isinsteadofisinsteadof intint 1=INSTEAD OF 触发器1=INSTEAD OF trigger

0=不是 INSTEAD OF 触发器0=Not an INSTEAD OF trigger
trigger_schematrigger_schema sysnamesysname 触发器所属的架构的名称。Name of the schema to which the trigger belongs.

权限Permissions

需要元数据可见性配置表的权限。Requires Metadata Visibility Configuration permission on the table.

示例Examples

以下示例执行 sp_helptrigger 以生成有关对 Person.Person 表的触发器的信息。The following example executes sp_helptrigger to produce information about the trigger(s) on the Person.Person table.

USE AdventureWorks2012;  
GO  
EXEC sp_helptrigger 'Person.Person';  

请参阅See Also

数据库引擎存储过程(Transact SQL) Database Engine Stored Procedures (Transact-SQL)
ALTER TRIGGER (Transact-SQL) ALTER TRIGGER (Transact-SQL)
CREATE TRIGGER (Transact-SQL) CREATE TRIGGER (Transact-SQL)
DROP TRIGGER (Transact-SQL) DROP TRIGGER (Transact-SQL)
系统存储过程 (Transact-SQL)System Stored Procedures (Transact-SQL)