Triggers on Views

  • I am working with a 3rd party db, and have created a view unioning data from different tables. I now want to put a trigger on the view for update, I has assumed that any changes made to the tables the view refernces would cause the trigger to be fired, this does not look to be the case, it only works when the data is updated via the view, I appreciate that this may be by design, but does anybody know of a workaround?

    StaffTable

    ==========

    StaffUsername

    FirstName

    Staff_Email

    StudentTable

    ============

    StudentUsername

    FirstName

    Student_Email

    UserView

    ========

    SELECT StaffUsername AS ExtUsername,Firstname.....

    UNION

    SELECT StudentUsername AS ExtUsername,Firstname.....

  • - view-triggers only fire when the view is being used !

    - you could place triggers on the underlying objects

    - Maybe an indexed view can help out, but consider the performance overead and read BOL ! 

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply