What is the difference between trigger and stored procedure
Go to top. Layout: fixed fluid. First Prev Next. My vote of 4 Member Jun Member I like it. My vote of 4 Andrea Quaglia 1-Sep Andrea Quaglia. My vote of 4 AlexCode Jul You cold have formatted this in a table like way SP on one side and triggers on the other, would have made it easier to relate. Anyway, one should run as far as possible from triggers My vote of 5 Member Jul My vote of 4 Mohammed Hameed Jul Mohammed Hameed.
My vote of 5 Brian A Stephens Jul Brian A Stephens. Stored procedure: Stored Procedures can't be called from a function because functions can be called from a select statement and Stored Procedures can't be called from. But you can call Store Procedure from Trigger. Store procedure: Stored Procedures can accept any type of parameter. Stored Procedures also accept out parameter.
Function: Function can accept any type of parameter. Store procedure: Stored Procedures may or may not return any values Single or table on execution. Triggers are useful, but they are avoided if there exist any alternative to them, as it increases data complexity.
Sometimes triggers are also substitutes by an appropriate procedure. Your email address will not be published. Key Differences Between Trigger and Procedure The primary difference between trigger and procedure is that a trigger is a statement that gets invoked automatically when an event has occurred. On the other hand, the procedure is invoked whenever it is required.
One can define procedure inside a trigger. But, a trigger is never defined inside a procedure as the trigger has to be invoked automatically on the occurrence of any event. We can pass parameters to procedures, but we can not pass parameters to trigger as it is not invoked by us. A procedure can return parameter values or code but, a trigger can not.
0コメント