Question

  • Creator
    Topic
  • #2170529

    SQL Trigger with store procedure.

    Locked

    by evga ·

    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?

All Answers

  • Author
    Replies
    • #2432025

      Clarifications

      by evga ·

      In reply to SQL Trigger with store procedure.

      Clarifications

    • #2431952

      Not sure what question 1 is asking

      by slayer_ ·

      In reply to SQL Trigger with store procedure.

      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.

Viewing 1 reply thread