Question Locked

SQL Trigger with store procedure.

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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?

2 replies

by slayer_

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.

This discussion is closed to new replies.