Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Posts
    4

    Unanswered: Please help: Views and INSTEAD OF UPDATE trigger

    Hi:

    Currently I have two tables T1 and T2. A view V1 is defined over T1 with an INSTEAD OF UPDATE trigger and another view V2 is defined over V1 and T2 with another INSTEAD OF UPDATE trigger. Unfortunately, inside V2’s trigger following update statement is not working:
    Update V1 set V1.name = i.name from inserted i
    because SQL server complains:
    View 'V1' has an INSTEAD OF UPDATE trigger and cannot be a target of an UPDATE FROM statement.
    Is there any way to get around this problem? I.e., how can I make the INSTEAD OF UPDATE trigger in V2 to work if I can’t reference “inserted”?

    Your help is appreciated,

    Jeff

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    I think the problem is not with your "inserted" table, but with the target of the insert (View V1).

    Modify your INSTEAD OF triggers so that they reference the underlying tables directly, rather than through secondary views.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •