Web Development



SQL Trigger with store procedure.

Looking for best practices and insight for SQL triggers.

1. Even though I have 1 record inserts, updates should I write multiple record queries and why?

2. During a trigger which has quite a bit of different inserts and things going on is it better to write a store procedure to be called from the trigger to handle this vs the trigger directly handling this and why?

Any other performance recommendations?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Not sure what question 1 is asking

by Slayer_ In reply to SQL Trigger with store pr ...

But for question two, I'd say it depends on what the trigger is doing. And if its something a user or application would need to run separately.
For example, say you made a trigger that created a new database backup each time it was run.
If an application needs this functionality, you should make it a stored proc, otherwise, a trigger is just fine.

That's my take on it anyways, but I am no DBA.

Related Discussions

Related Forums