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 |
|
allan_houston
Starting Member
18 Posts |
Posted - 2006-07-16 : 17:16:10
|
| HelloIs it possible to exit and abort the transaction in a trigger and how?Likecreate trigger trig_delDepton deptfor deleteasdeclare @loc varchar(20)select @loc = loc from deletedif @loc = 'SAN FRANCISCO'--exit codekind regardsa.h. |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2006-07-16 : 17:23:19
|
| The deleted table contains all the rows that were deleted, which can be more than one.You could put something like this in the trigger:if exists(select * froom deleted where loc = 'SAN FRANSISCO')beginrollbackraiserror('Deletion of SAN FRANSISCO not allowed',16,1)endrockmoose |
 |
|
|
allan_houston
Starting Member
18 Posts |
Posted - 2006-07-16 : 17:36:07
|
| Thx rockmoose. It helped |
 |
|
|
|
|
|