Thursday, 22 October 2009

What is difference between Trigger and a Stored Pr.

TRIGGER

1- when you create a trigger you have to identify event and action of your trigger but when you create s.p you don't identify event and action

2-trigger is run automatically if the event is occured but s.p don't run automatically but you have to run it manually

3- within a trigger you can call specific s.p but within a s.p you cann;t call atrigger



Difference between Truncate and Delete ?
Truncate is a DDL command and hence cant be rolled back
Truncate can not fire a trigger.
Truncate is unconditional.
Truncate removes all records but using this we cannot
remove a particular record.
where as delete is DML command and thus can be rolled back.
Delete can fire a trigger.
We can specify a condition while using deletecommand.