April 3, 2002 at 8:13 pm
I am trying to see if a "IF" condition in a trigger is executed or not and so I am trying to use the "PRINT" command in my trigger, but nothing seems to be printing to the screen. Even though the if statement is being executed, why is the "PRINT" statement not printing anything to the screen? Am I missing something here? I also tried using "RAISERROR", but did not work.
Any help will be greatly appreciated.
Thanks
Sharma
April 3, 2002 at 8:25 pm
Try this
CREATE TRIGGER trWhatever ON tblWhatever FOR INSERT, UPDATE, DELETE
AS
If conditiontomeet
BEGIN
RAISERROR('Yes',16,-1)
RETURN
END
ELSE
BEGIN
RAISERROR('No',16,-1)
RETURN
END
Should return one or the other to be sure what is occurring.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
April 3, 2002 at 8:30 pm
To look at the message in a PRINT or RAISERROR, do I have to run my trigger in the QUERY ANALYZER????
Sharma
April 4, 2002 at 5:06 am
Yes QA will be the best place to view these quickly, oherwise you have to capture the return error in code or print message.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply