Wht is the difference between stored procedure and trigger

Answer Posted / rajvelur

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 ?    29 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between delete and truncate statements?

563


How to find a value in another dataset based on current dataset field (ssrs 2008 r2)?

114


Differentiate between a local and a global temporary table?

541


What is the command used to recompile the stored procedure at run time?

612


What are scalar functions?

495






Do you know what is a trace frag? Where do we use it?

548


What is function of CUBE ?

604


How to retrieve field values using mssql_result()?

626


What is a trace frag?

635


What are “lost updates”?

607


Can you always create a cache of a report?

115


What is raid, and how it can influence database performance?

568


Once setting replication, is it potential to own a publisher as sixty four bit sql server and distributor or subscribers as a thirty two bit sql server?

543


Explain the various types of concurrency problem. I.e. Lost or buried updates, uncommitted dependency, inconsistent analysis, phantom read?

497


Please explain that what are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture

552