BUG: Can't Insert into Views That Have INSTEAD OF Trigger in Enterprise Manager (288969)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q288969
BUG #: 351731 (SHILOH)

SYMPTOMS

SQL Server Books Online states that it is possible to insert values for timestamp, identity, and computed columns in views that have INSTEAD OF triggers defined on them.

If you attempt to do this in Enterprise Manager, you receive the following error message:
Cannot edit this cell

WORKAROUND

To work around this problem, use Query Analyzer to insert into the these columns.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 2000.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a table with an identity column as follows:
    CREATE TABLE myTab(
    c1 int,
    c2 int identity(1,1))
    					
  2. Create a view that reads from the table:
    CREATE VIEW myView as 
           SELECT * FROM myTab
  3. Create an INSTEAD OF insert trigger on the view:
    CREATE TRIGGER myTrig ON myView INSTEAD OF INSERT AS
           INSERT INTO myTab(c1) SELECT c1 FROM inserted
    					
  4. In Enterprise Manager, right-click the view, point to Open View, and select Return all rows.
  5. In the new window, if you attempt to insert into the identity column, the error message is displayed.

Modification Type:MajorLast Reviewed:10/3/2003
Keywords:kbbug kbpending KB288969 kbAudDeveloper