Using Triggers in Stored Procedures | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Using Triggers in Stored Procedures

Hello, Can we have triggers inside the stored procedures in SQL Server 2000. If we can have than how can we have and how they are used.
Thanks in Advance Thanks,
Paritosh
triggers are defined on the tables themselves, and trigger when the table is changed. This is true whether the change is made from a stored proc or a raw sql batch
You cant call or execute a trigger explicitely. They are fired when there are inserts, updates or deletes in the table in which trigger is defined Madhivanan Failing to plan is Planning to fail
Triggers allow you to respond to data manipulation on a table, whatever caused the manipulation. Usually, this allows you to check for data integrity in ways not covered by referential integrity, to set a "default after update", etc. etc. Triggers will always fire. When you create procedures to manipulate the data, you should keep the triggers in mind. If you start some data manipulation from a stored procedure, and a trigger on the table could raise an error and do a rollback transaction, then your procedure should catch that error and respond accordingly.
]]>