Difference between Triggers and Stored Procedure

Answer Posted / manoj kopardekar

STORED PROCEDURE
A stored procedure is an already written SQL statement that
is saved in the database. We can run the stored procedure
from the database's command environment

1.Precompiled execution. SQL Server compiles each stored
procedure once and then reutilizes the execution plan. This
results in tremendous performance boosts when stored
procedures are called repeatedly.
2.Reduced client/server traffic. If network bandwidth is a
concern in your environment, you'll be happy to learn that
stored procedures can reduce long SQL queries to a single
line that is transmitted over the wire.
3.Efficient reuse of code and programming abstraction.
Stored procedures can be used by multiple users and client
programs. If you utilize them in a planned manner, you'll
find the development cycle takes less time.
4.Enhanced security controls. You can grant users permission
to execute a stored procedure independently of underlying
table permissions.


TRIGGER

A trigger is an object contained within an SQL Server
database that is used to execute a batch of SQL code
whenever a specific event occurs. As the name suggests, a
trigger is “fired” whenever an INSERT, UPDATE, or DELETE SQL
command is executed against a specific table.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is null vs coalesce?

511


Explain the rules for designing files and file groups in sql server?

554


code to create procedure for taking databse backup in sql server or i have the query for it but what it's query returns means i want to show on my jsp that the databse backup has been taken on the basis of that return value.does it returns 0 or 1.wat is the code for that

1758


What are the types of stored procedures in an sql server?

480


Insert syudents details in table.Current system date &time insert into joining time.How do insert?( in sysdate only return current system date how do add time?)

1436






How to create an inline table-valued function?

540


Tell me what is the order in which the sql query is executed?

533


What is query and its types?

516


You want to implement the many-to-many relationship while designing tables. How would you do it?

568


How to test values returned by a subquery with the in operator?

677


why would you use sql agent? : Sql server database administration

531


What programming language would you use to create embedded functions in ssrs?

122


What is SQL Azure Federations?

98


How to throw custom exception in Stored Procedure?

584


What are the differences between decimal and float in ms sql server?

569