FIX: Primary Key Violation Causes AV, Text Field Involved

ID: Q176092


The information in this article applies to:
  • Microsoft SQL Server version 6.5

BUG #: 17426 (6.5)

SYMPTOMS

On a second insert into a table that has a text field, you receive the following message:

DB-Library Process Dead - Connection Broken
When this problem occurs, there will also be a handled access violation (AV) with a stack trace in the SQL Error Log.

A second insert into a table with the same value for the primary key may cause a handled exception that closes the client connection to the server if all of the following conditions are true:
  • The table has a text column.


  • The table has a trigger.


  • The trigger queries another table to determine the correct primary key value for the original table.


  • Another table has a foreign key reference to the original table.



WORKAROUND

The conditions described in the SYMPTOMS section of this article are really a means to create an ascending or descending key value. To work around this problem, use either of the following two more efficient ways to create an ascending or descending key value:

  • Use an IDENTITY column on the original table.


  • or

  • Use a stored procedure that picks up the new primary key before inserting into the first table. Remove the trigger from the first table.



STATUS

Microsoft has confirmed this to be a problem in SQL Server version 6.5. This problem has been corrected in U.S. Service Pack 5a for Microsoft SQL Server version 6.5. For information about downloading and installing the latest SQL Server Service Pack, see http://support.microsoft.com/support/sql/.

For more information, contact your primary support provider.


MORE INFORMATION

Additional query words: terminate terminates quits quit stop stops

Keywords : kbusage SSrvTran_SQL kbbug6.50 kbfix6.50.SP5
Version : winnt:6.5
Platform : winnt
Issue type : kbbug


Last Reviewed: November 17, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.