Ankur Jain
What is the difference between Triggers and Stored Procedure?
By Ankur Jain in Databases & DBA on Aug 18 2014
  • Pankaj  Kumar Choudhary
    Aug, 2015 28

    Stored Procedures are called by the programmer wherever it wants to fire but triggers fired automatically when insert,delete,update occured. And triggers can be implemented to tables & views only where as stored procedure used in the database independently.

    • 1
  • Joe Wilson
    Jul, 2015 20

    Hi, You can easily control the execution of stored procedure, but triggers don't have this feature.

    • 1
  • Rahul Prajapat
    May, 2015 27

    Stored Procedures are called by the programmer wherever it wants to fire but triggers fired automatically when insert,delete,update occured. And triggers can be implemented to tables & views only where as stored procedure used in the database independently.

    • 1
  • Shivam Shukla
    Feb, 2015 4

    1.We can execute a stored procedure whenever we want with the help of the exec command, but a trigger can only be executed whenever an event (insert, delete, and update) is fired on the table on which the trigger is defined. 2.We can call a stored procedure from inside another stored procedure but we can't directly call another trigger within a trigger. We can only achieve nesting of triggers in which the action (insert, delete, and update) defined within a trigger can initiate execution of another trigger defined on the same table or a different table. Stored procedures can be scheduled through a job to execute on a predefined time, but 3.we can't schedule a trigger. 4.Stored procedure can take input parameters, but we can't pass parameters as input to a trigger. 5.Stored procedures can return values but a trigger cannot return a value. 6.We can use Print commands inside a stored procedure for debugging purposes but we can't use print commands inside a trigger. 7.We can use transaction statements like begin transaction, commit transaction, and rollback inside a stored procedure but we can't use transaction statements inside a trigger. 8.We can call a stored procedure from the front end (.asp files, .aspx files, .ascx files, etc.) but we can't call a trigger from these files. 9.Stored procedures are used for performing tasks. Stored procedures are normally used for performing user specified tasks. They can have parameters and return multiple results sets. 10.The Triggers for auditing work: Triggers normally are used for auditing work. They can be used to trace the activities of table events.

    • 1
  • Nisha Regil
    Sep, 2020 8

    Trigger and Procedure are Component of Advanced SQL. Trigger and Procedure both perform a specified task on their execution. The fundamental difference between Trigger and Procedure is that the Trigger executes automatically on occurrences of an event whereas, the Procedure is executed when it is explicitly invoked

    • 0
  • Pankaj  Kumar Choudhary
    Aug, 2015 28

    Stored Procedures are called by the programmer wherever it wants to fire but triggers fired automatically when insert,delete,update occured. And triggers can be implemented to tables & views only where as stored procedure used in the database independently.

    • 0
  • sajidlkhan lodi
    Feb, 2015 10

    Store Procedures are manually executed while triggers are implicitly executed whenever we change in database.

    • 0
  • sajidlkhan lodi
    Feb, 2015 10

    Store Procedures are manually executed while triggers are implicitly executed whenever we change in database.

    • 0
  • Munesh Sharma
    Oct, 2014 9

    Difference between Stored Procedure and Trigger: 1) Stored Procedure is predefined collection of sql statements. 2) Stored Procedure is Precompiled Execution. 3) Trigger is not Precompiled Exectution. 4) Trigger is not Reduce Client / Server Network Traffic. 5) Trigger Execute Automatic Execution Process. Stored Procedure is not automatic Procedure process.

    • 0
  • Mahanti Chiranjeevi
    Sep, 2014 9

    Adding one more difference: Triggers will not take any argument while procedure and functions takes arguments.

    • 0
  • Ankur Jain
    Aug, 2014 18

    Stored Procedures are called by the programmer wherever it wants to fire but triggers fired automatically when insert,delete,update occured. And triggers can be implemented to tables & views only where as stored procedure used in the database independently.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS