18.3.08

Triggers inside Stored procedure

Got a query from users like, “Is it possible to use trigger inside stored procedure. If not why? if yes how?” Its quite interesting question,

1. My answer is “No” we can’t use trigger inside stored procedure because trigger is an object which is binded with table objects.
2. The inherent property of the trigger is to fire automatically if any condition breaks and its associated with DML operations. But we are trying to create and initiate it from the stored procedure.
3. It will loose its property as a System object.

a. My answer is “Yes” oops confusing. To provide an alternative way, Microsoft provides us a new concept named CLR integration in sql server 2005.
b. We can create Managed trigger and wrap it in the stored procedure.

Regards,
Venkatesan Prabu . J

No comments:

Post a Comment