Article ID: 294311 - Last Review: November 6, 2003 - Revision: 3.2

FIX: Trigger Does Not Return Expected Duplicate Key Insert Error to Client

This article was previously published under Q294311
BUG #: 236053 (SHILOH_BUGS)
Expand all | Collapse all

SYMPTOMS

When all of the following conditions are true, an expected error message may not be returned to the client for a duplicate key insert failure:
  • A distributed query is used.
  • The table has a trigger.
  • The trigger contains both a SELECT statement that returns a result set and a statement such as INSERT or UPDATE.
  • Within the trigger, the INSERT or UPDATE is performed on a table with a unique key and attempts to insert a duplicate record.
The UPDATE or INSERT statement within the trigger is terminated when it tries to insert a duplicate key row in the object, but it fails to report the expected duplicate key error to the client.

RESOLUTION

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 the Microsoft Knowledge Base:
290211  (http://support.microsoft.com/kb/290211/EN-US/ ) INF: How to Obtain the Latest SQL Server 2000 Service Pack

WORKAROUND

When coding in a trigger, avoid using SELECT statements which return a result set.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.

APPLIES TO
  • Microsoft SQL Server 2000 Standard Edition
Keywords: 
kbbug kbfix kbsqlserv2000sp1fix KB294311
 

Article Translations

 

Related Support Centers