LearnItFirst User Forum

New SQL Server 2008 DBA Course
Welcome Guest Search | New Posts | Members | Log In | Register

cancel 'triggering' operation Options
laailalalaa
Posted: Monday, May 04, 2009 8:48:04 AM
Rank: Newbie

Joined: 3/2/2009
Posts: 7
Points: 21
hello
how can i cancel the operation that triggered.. a trigger in some cases?
say i have an after insert trigger for a Students(id int, name varchar(15)) table and if i try to insert a student with an empty name i want the trigger to raise an error and cancel the insert operation.
thank you
Scott Whigham
Posted: Tuesday, May 12, 2009 11:53:30 AM


Rank: Super Mod

Joined: 3/20/2006
Posts: 460
Points: 1,002
Where do you live?: Dallas, TX
CREATE TRIGGER MyTrigger...
AS
IF(some logic)
ROLLBACK
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.