PRB: Trigger Does Not Fire on View When Updated Through ADO (304096)
The information in this article applies to:
- Microsoft SQL Server 2000 (all editions)
- ActiveX Data Objects (ADO) 2.6
This article was previously published under Q304096 SYMPTOMS
When you use an INSTEAD OF trigger on a SQL Server updatable view, the trigger fires when an UPDATE, INSERT or DELETE statement occurs through the view. However, if ADO Update or UpdateBatch methods are used with a client-side cursor, using either the SQLOLEDB or the ODBC SQL Server driver, the INSTEAD OF trigger does not fire.
CAUSE
By default, ADO uses the base table names that are contained in the view to update the information in the tables. Because the trigger is associated with the view name, the trigger is not fired.
RESOLUTION
SQL Server 2000 allows you to use the VIEW_METADATA attribute when you create the updatable view. This option allows SQL Server to pass the view name instead of the base table names that are to be used during updates. Views that are created with this attribute allow triggers that are associated with the view to fire when the triggers are updated through ADO.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 10/17/2003 |
---|
Keywords: | kbprb KB304096 |
---|
|