Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    162

    Unanswered: Trigger on view?

    how does a trigger on a view works? What is the differens between a trigger on a table and a trigger on a view? What to think of?
    Can i simply create a trigger on a view and expect that to work just like a trigger on a table?

    I need to update one table from a view as soon as that view generate new records. The view is based on 6 tables. Is this possible?

    Im using MS SQL 2008 64-bits std on windows 2008 R2


    thx for help in advance

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Quote Originally Posted by mrpcguy View Post
    I need to update one table from a view as soon as that view generate new records. The view is based on 6 tables. Is this possible?
    No. For the simple reason that views do not "generate" records.
    You can create an "instead of" trigger on a view to allow you to update it as you would a table, or perhaps perform some other operation when transactions are executed against it.
    But a view has no idea whether it contains newly "generated" records or not.
    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
  •