다음을 통해 공유


Trigger Object

Microsoft SQL Server의 이후 버전에서는 이 기능이 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 말고, 현재 이 기능을 사용하는 응용 프로그램은 수정하십시오.

The Trigger object exposes the attributes of a single Microsoft SQL Server trigger.

현재 개체를 보여 주는 SQL-DMO 개체 모델

Properties

AnsiNullsStatus Property

Owner Property (Database Objects)

CreateDate Property

QuotedIdentifierStatus Property

Enabled Property

SystemObject Property

ID Property

Text Property

Name Property

Type Property (Trigger)

Methods

Alter Method

Remove Method (Objects)

EnumDependencies Method

Script Method

주의

SQL Server supports using triggers as a kind of stored procedure. Triggers are run when a specified data modification, such as an attempt to delete a row, is attempted on the table on which the trigger is defined. With the Trigger object, you can:

  • Create a SQL Server trigger on an existing SQL Server table.
  • Remove an existing SQL Server trigger from a SQL Server table.
  • Generate a Transact-SQL script to use in other tools to re-create an existing SQL Server trigger.
  • Change ownership of an existing SQL Server trigger.

The Name property of a Trigger object is a character string. The value of the property identifies a SQL Server trigger by name and must conform to the rules for trigger naming. The Name property is required when creating a SQL Server trigger.

To create a trigger on an existing SQL Server table

  1. Create a Trigger object.

  2. Set the Name property.

  3. Set the Text property to contain the Transact-SQL script defining the SQL Server trigger behavior. For more information about trigger scripts, see CREATE TRIGGER(Transact-SQL).

  4. Get the Table object referencing the SQL Server table you want from the Tables collection of the appropriate Database object.

  5. Use the BeginAlter method of the Table object to mark the start of changes to the SQL Server table definition.

  6. Add the new Trigger object to the Triggers collection of the selected Table object.

  7. Use the DoAlter method of the Table object to mark the end of changes and create the SQL Server trigger.

[!참고] The Trigger object is compatible with instances of SQL Server versions 7.0 and later. However, the Trigger2 object extends the functionality of the Trigger object for use with features that were introduced in SQL Server 2000.

참고 항목

참조

Trigger2 Object

도움말 및 정보

SQL Server 2005 지원 받기