Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
laailalalaa
Yak Posting Veteran
57 Posts |
Posted - 2009-04-14 : 10:32:12
|
| how do i stop an insert action to take place in an after insert trigger (when let's say i inserted more than one record at a time)?thank you |
|
|
asgast
Posting Yak Master
149 Posts |
Posted - 2009-04-15 : 03:25:57
|
| you can't stop an insert action in after insert trigger. AFTER specifies that the trigger is fired only when all operations specified in the triggering SQL statement have executed successfully. All referential cascade actions and constraint checks also must succeed before this trigger fires.Well you can always delete the inserted data, but I think you want to use INSTEAD OF trigger. |
 |
|
|
laailalalaa
Yak Posting Veteran
57 Posts |
Posted - 2010-04-27 : 11:23:01
|
yes, learned all one can do is rollback the transaction.quote: Originally posted by asgast you can't stop an insert action in after insert trigger. AFTER specifies that the trigger is fired only when all operations specified in the triggering SQL statement have executed successfully. All referential cascade actions and constraint checks also must succeed before this trigger fires.Well you can always delete the inserted data, but I think you want to use INSTEAD OF trigger.
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-27 : 11:28:19
|
| yup. or check for your rules and do insert only if it satisfies inside INSTEAD OF trigger------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|