FIX: INSERT Into w/ IDENTITY Col Inside Trigger Causes AV

Last reviewed: May 1, 1997
Article ID: Q136534

The information in this article applies to:
  • Microsoft SQL Server, version 6.0
BUG# NT: 10242 (6.00)

SYMPTOMS

An INSERT INTO a table with an IDENTITY column inside a trigger can cause a handled access violation (AV).

CAUSE

The AV occurs only if the table with an IDENTITY column has a trigger. The trigger may be fired by either an INSERT, DELETE, or UPDATE operation. The client does not cause an AV when a SELECT INTO operation is performed on a table that is not using the IDENTITY property.

WORKAROUND

If your purpose in performing an INSERT operation inside a trigger is to implement Unique Increasing key values without using the IDENTITY property of SQL Server version 6.0, then please refer to the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q75164
   TITLE     : Implementing a Unique, Increasing Key Value

If your objective is to implement Declarative Referential Integrity (DRI), use the DRI feature of SQL Server version 6.0, or implement it by using tables without IDENTITY columns. Refer to the SQL Server "Transact-SQL Reference" manual for details on DRI implementation with triggers.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.0. This problem was corrected in Service Pack 2 for SQL Server version 6.0. For more information, contact your primary support provider.


Additional query words: sql6 identity primary keys
Keywords : kbbug6.00 kbfix6.00.sp2 kbprg SSrvDRI
Version : 6.0
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 1, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.