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
Is null in sql server?
Define msdb database?
What are the system database in sql server 2008?
Explain various On-Delete options in a DB table. Which is the default option?
what stored procedure can you use to display the current processes? : Sql server administration
What are different types of raid configurations? : SQL Server Architecture
What are the advantages of using cte?
What do you understand by mirroring and mention the advantages of the mirroring?
You are designing a strategy for synchronizing an SQL Azure database and multiple remote Microsoft SQL Server 2008 databases. The SQL Azure database contains many tables that have circular foreign key relationships?
How to see the event list of an existing trigger using sys.trigger_events?
You have a table ‘test’ which is a copy of northwind employee table you have written a trigger to update the field ‘hiredate’ with the current date
What are the main differences between #temp tables and @table variables and which one is preferred?
What are the requirements on sql server network connections?
What is conditional split?
Can you change the data type of a column in a table after the table has been created? If so, which command would you use?