• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Triggers on views

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    #11
    Originally posted by BrilloPad View Post
    CREATE TRIGGER [dbo].[my_trigger_name] ON [dbo].[my_view_name]

    INSTEAD OF UPDATE, INSERT
    AS
    BEGIN
    .
    .
    .
    END

    THERE IS NO VALID REASON!

    Its just obfuscation.
    You may want to put constraints on the data which a normal constraint would not be able to handle.
    A trigger can catch those inserts or updates which break the business rules, return an error and rollback the insert/update.

    It makes more sense to put that sort of constraint in the table/view trigger than having to define than allow potentially bad data into the table and always trust other applications to behave properly.
    Coffee's for closers

    Comment

    Working...
    X