execute triggers externally

  • I mean can we execute triggers by directly invoking them as we call the stored procedure or the UDFs. Is there any way to do so through front end (using VB or C#). If any body has an answer for this question pls do reply

    Regards

    Avaneesh Bajoria.

  • I dont think it is a relavent question.

    As if u direct execute them how do u get data into inserted..... tables.

    So, it can not be allowed to do like that.

  • The short version of the answer is, "No, this is not allowed."

  • TRIGGERS are based on an INSERT, UPDATE, or DELETE happening. So, you can cause a trigger to fire by simply doing one of those actions - it does not mean you have to change anything:

    UPDATE MyTable SET Field1 = Field1

    The update trigger would fire and I have not really changed any data.

    If you find yourself having to do this regularly, it is a big red flag that you are likely to have a design issue. Triggers are there to act on data changes, so if you need them to act when there is not a data change, you are likely to have misused them.

    If this is simply because triggers were disabled for some time and you need them to fire now, I can see that being a reasonable reason for having to do something like this.

Viewing 4 posts - 1 through 3 (of 3 total)

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