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
What is difference between materialized view and view?
how to control the amount of free space in your index pages? : Sql server database administration
What is the sql case statement used for?
What is the difference between for auto and for nested?
Mention the command used to rename the database.
What are wait types?
How to update muliple row in single query?
Which tcp/ip port does the sql server run on? How can it be changed?
What is database mirroring?
What are two difference between sql azure and azure tables?
How can sql server instances be hidden? : sql server security
What is the difference in accessing db between sql server vs sql azure?
what is a deadlock? : Sql server database administration
What are temporal tables in sql server 2016?
What is ms sql server service broker?