Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

execute triggers externally Expand / Collapse
Author
Message
Posted Friday, June 20, 2008 5:46 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Saturday, November 27, 2010 11:14 PM
Points: 356, Visits: 99
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.
Post #520562
Posted Friday, June 20, 2008 5:53 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, February 4, 2013 7:02 AM
Points: 465, Visits: 94
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.
Post #520568
Posted Friday, June 20, 2008 6:06 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, November 4, 2013 4:22 PM
Points: 480, Visits: 467
The short version of the answer is, "No, this is not allowed."
Post #520580
Posted Friday, June 20, 2008 6:06 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, August 10, 2010 5:07 AM
Points: 2,661, Visits: 23,078
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.
Post #520581
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse