Trigger.Create 메서드

Creates a trigger on the instance of SQL Server as defined by the Trigger object.

네임스페이스:  Microsoft.SqlServer.Management.Smo
어셈블리:  Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)

구문

‘선언
Public Sub Create
‘사용 방법
Dim instance As Trigger

instance.Create()
public void Create()
public:
virtual void Create() sealed
abstract Create : unit -> unit  
override Create : unit -> unit
public final function Create()

구현

ICreatable.Create()

'Connect to the local, default instance of SQL Server.
Dim mysrv As Server
mysrv = New Server
'Reference the AdventureWorks2012 2008R2 database.
Dim mydb As Database
mydb = mysrv.Databases("AdventureWorks2012")
'Declare a Table object variable and reference the Customer table.
Dim mytab As Table
mytab = mydb.Tables("Customer", "Sales")
'Define a Trigger object variable by supplying the parent table, schema ,and name in the constructor.
Dim tr As Trigger
tr = New Trigger(mytab, "Sales")
'Set TextMode property to False, then set other properties to define the trigger.
tr.TextMode = False
tr.Insert = True
tr.Update = True
tr.InsertOrder = Agent.ActivationOrder.First
Dim stmt As String
stmt = " RAISERROR('Notify Customer Relations',16,10) "
tr.TextBody = stmt
tr.ImplementationType = ImplementationType.TransactSql
'Create the trigger on the instance of SQL Server.
tr.Create()
'Remove the trigger.
tr.Drop()

참고 항목

참조

Trigger 클래스

Microsoft.SqlServer.Management.Smo 네임스페이스

관련 자료

트리거 생성, 변경 및 제거

DML 트리거

CREATE TRIGGER(Transact-SQL)