Difference between Triggers and Stored Procedure
Answers were Sorted based on User's Feedback
Answer / ram
Stored Procedures are called by the programmer wherever it
wants to fire but triggers fired automatically when
insert,delete,update occured. And triggers can be
implemented to tables & views only where as s.p used in the
database independently
| Is This Answer Correct ? | 135 Yes | 13 No |
Answer / pankaj arya
To use stored procedure you have to make a call to that
procedure but Triggers fired automatically when an event is
occurred on the table associated with that Trigger like add,
insert or delete.
| Is This Answer Correct ? | 108 Yes | 7 No |
Answer / bed singh
1. Triggers can only be implemented on tables or views but
Stored Procedure in independent code that can be specific
to database.
2. Triggers are automatically run but stored procedures are
not automatically run and they have to be called explicitly
by the user.
3. we can write a stored procedure within a trigger but
cannot write a trigger within a stored procedure.
4. Trigger is attached to table or view and is fired only
when an INSERT, UPDATE, and/or DELETE occurs, while a
stored procedure executes at any time when it is called.
| Is This Answer Correct ? | 75 Yes | 9 No |
Answer / gopal chauhan
Stored Procedure can give one output paramenter,but
Triggers can not give any output parameter
| Is This Answer Correct ? | 61 Yes | 20 No |
Answer / madhu prakash p
sp and trigger are both predefined set of sql statements
we can pass the arguments for sp but we cant pass the
arguments for triggers.
trigger will fire implicitly, when ever relavent action
performed by the user on the tables where the triggers are
placed.
But in the stored procedures u must call explicitly.
| Is This Answer Correct ? | 43 Yes | 9 No |
Answer / ghanshyam vrema
1. SP may Return a value but Trigger Not,
2. In SP you can pass parameter But in trigger you can't
3. we explicitly call the Sp when Trigger are implicitly
fired
4. you can write a sp in Trigger but in a Trigger you cant
write SP.
5. Trigger written on an individual Table or View where SP
is written for an Database
| Is This Answer Correct ? | 75 Yes | 43 No |
Answer / avdhesh yadav
1. Stored Procedure may Return a value but Trigger Not,
2. In Stored Procedure you can pass parameter But in
trigger you can't
3. we explicitly call the Stored Procedure when Trigger are
implicitly
fired
4. you can write a Stored Procedure in Trigger but in a
Trigger you cant
write Stored Procedure.
5. Trigger written on an individual Table or View where
Stored Procedure
is written for an Database
| Is This Answer Correct ? | 29 Yes | 7 No |
Answer / pramod bansode
1> For executing Sp we have to call Stored Procedure. But in
case of Trigger it is call whenever there is an action taken
on table or column(Insert, Update ,Delete).
2> From SP we pass Values But from Trigger we cant.
3> stored procedure returns value but trigger cannot returns
value.
4> For SP we have to compile. for Trigger no need to compile.
5> we return SP in Trigger but Trigger can not be in SP.
| Is This Answer Correct ? | 18 Yes | 8 No |
Answer / shilpa
triggers are fired automatically when any event ocours like
update ,delete ,insert on a table
whereas sp is set of sql statements its not related to
single table but its can have many sql satements that can
be used in many tables to update, delete and insert .
| Is This Answer Correct ? | 7 Yes | 2 No |
Answer / naveen jindal
trigger fired implicitely that is when ever events like
insert/update/delete commands.
Where as stored procedure is not fired implicitely. when
ever we call then only the stored procedure fire.
| Is This Answer Correct ? | 6 Yes | 1 No |
How can you find out how many rows returned in a cursor?
How to create view in stored procedure sql server?
How to add additional conditions in SQL?
What do you mean by subquery?
What is the function of inner join?
What security features are available for stored procedure?
what is a transaction and what are acid properties? : Sql server database administration
How do I create a trace in sql server?
Explain query editor regions
what is a join? : Sql server database administration
In my application I have a process which picks the scanned files (tif format) from a shared location and it links to application and shown on it.The actuall issue is that my process picks the file before it is completly written or scanned which results in displaying few parts of the image or incomplete image.I need to check if the file is not completly scanned or written then do not link it to application.Please help if any body tell me that how can i check that file is in written phase or locked through DTS.thanking you in advance
How to test odbc dsn connection settings?
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)