FIX: Trigger May Not Fire if Query Plan Uses CONSTANT SCAN Operator
This article was previously published under Q299857
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 235577 (SHILOH_BUGS)
A trigger may not fire if the query does not modify any rows and the execution plan contains the CONSTANT SCAN operator.
To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in theMicrosoft Knowledge Base:
290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack
Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.
The following code demonstrates the problem:
The last update query uses a CONSTANT SCAN operator; the SHOWPLAN for this query is as follows:
create table table_xyz (col_a int constraint cst_name check(col_a < 100))gocreate clustered index myidx on table_xyz(col_a)gocreate trigger trig_upd on table_xyz for update asprint '(Trigger): Update trigger fired'goset nocount on-- This update will fire the trigger.print 'This will fire trigger'update table_xyz set col_a=1 where col_a > 32767goprint ''-- This update will not fire the trigger.print 'This will not fire trigger'update table_xyz set col_a=1 where col_a > 32768go
StmtText------------------- |--Constant Scan
Article ID: 299857 - Last Review: 01/16/2015 22:46:28 - Revision: 3.2
Microsoft SQL Server 2000 Standard Edition
- kbnosurvey kbarchive kbbug kbfix kbsqlserv2000sp1fix KB299857