Created
February 26, 2015 06:07
-
-
Save eternaltung/6953ad9b65d3a4499671 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TRIGGER [dbo].[NumTrigger] | |
ON [dbo].[testTable] | |
FOR UPDATE | |
AS | |
BEGIN | |
print 'begin trigger' | |
if UPDATE(Num) | |
BEGIN | |
DECLARE @num int | |
select @num=Num from inserted | |
print 'inserted num:' + cast(@num as nvarchar) | |
if @num>5 | |
BEGIN | |
print 'raiseerror in trigger' | |
RAISERROR('Error:Trigger', 16, 2) | |
rollback | |
End | |
End | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment