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

This article was previously published under Q294311
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 236053 (SHILOH_BUGS)
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 theMicrosoft Knowledge Base:
290211 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.
Properties

Article ID: 294311 - Last Review: 01/16/2015 22:08:17 - Revision: 3.2

  • Microsoft SQL Server 2000 Standard Edition
  • kbnosurvey kbarchive kbbug kbfix kbsqlserv2000sp1fix KB294311
Feedback