Microsoft KB Archive/288174

= FIX: Modifying a Table with DRI Cascade That Is Involved in an Indexed View May Cause Msg 8624 =

Article ID: 288174

Article Last Modified on 11/6/2003

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q288174



BUG #: 350912 (SHILOH_bugs)



SYMPTOMS
When a user deletes or updates a record in SQL Server, an internal error may be raised:

Server: Msg 8624, Level 16, State 1, Line 1

Internal SQL Server error.

An error message is returned to the client. No error message or access violation information is written to the SQL Server error logs. The record is not deleted or updated.



CAUSE
This error can only occur when a member table of an indexed view is updated or deleted and there is a DRI CASCADE constraint between the table and other tables in the view. Check to see if the table is defined with either a cascading delete or update constraint. Then check to see if there is a view with an index that depends on the tables.



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 INF: How to Obtain the Latest SQL Server 2000 Service Pack



WORKAROUND
To work around this problem, remove the DRI CASCADE constraint or the index on the view.



STATUS
Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.



MORE INFORMATION
To reproduce this problem, run the following script: set ansi_nulls on set ansi_padding on set ansi_warnings on set arithabort on set concat_null_yields_null on set quoted_identifier on set numeric_roundabort off go

CREATE TABLE [dbo].[adults] (   [AdultId] [int] NOT NULL,    [FName] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,    [LName] [varchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ) ON [PRIMARY] GO

CREATE TABLE [dbo].[kids] (   [AdultId] [int] NOT NULL,    [KidId] [int] NOT NULL ,    [FName] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,    [LName] [varchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ) ON [PRIMARY] GO

ALTER TABLE [dbo].[adults] WITH NOCHECK ADD CONSTRAINT [PK_adults] PRIMARY KEY CLUSTERED (       [AdultId]    )  ON [PRIMARY] GO

ALTER TABLE [dbo].[kids] ADD CONSTRAINT [FK_kids_adults] FOREIGN KEY (       [AdultId]    ) REFERENCES [dbo].[adults] (        [AdultId]    ) ON DELETE CASCADE  ON UPDATE CASCADE GO

SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO

/****** Object: View dbo.v_AdultsWithKids    Script Date: 1/2/01 4:30:41 AM ******/

create view dbo.v_AdultsWithKids with schemabinding as

select a.adultid, a.fname as 'Adult First Name', a.lname as 'Adult Last Name', k.kidid, k.fname as 'Kid First Name', k.lname as 'Kid Last Name' from dbo.adults a inner join dbo.kids k on a.adultid = k.adultid

GO

SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO

set ANSI_PADDING,ANSI_WARNINGS,CONCAT_NULL_YIELDS_NULL,ARITHABORT,QUOTED_IDENTIFIER,ANSI_NULLS on GO

set NUMERIC_ROUNDABORT off GO

CREATE UNIQUE  CLUSTERED  INDEX [iv_cl_kidid] ON [dbo].[v_AdultsWithKids]([kidid]) ON [PRIMARY] GO

insert into adults values (1, 'Bob', 'Johnson') insert into kids values (1, 1, 'Joe', 'Johnson') insert into kids values (1, 2, 'Jack', 'Johnson') insert into kids values (1, 3, 'June', 'Johnson')

insert into adults values (2, 'Mary', 'Thomas') insert into kids values (2, 4, 'John', 'Thomas')

insert into adults values (3, 'Susan', 'Sist') go

delete from adults where adultid = 2 go

set NUMERIC_ROUNDABORT off set arithabort OFF GO

SET QUOTED_IDENTIFIER OFF SET ANSI_NULLS ON GO

Additional query words: DRI Cascade Indexed views

Keywords: kbbug kbfix kbsqlserv2000sp1fix KB288174

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.