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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Run trigger when two fields match

Author  Topic 

ConfusedAgain
Yak Posting Veteran

82 Posts

Posted - 2012-04-17 : 05:45:27
I am trying to run a trigger when two fields in the inserted table match:

Struggling at the moment I have something like this:

IF EXISTS (SELECT * FROM inserted WHERE inserted.SelectedAnswer = inserted.CorrectAnswer )
BEGIN

Then the trigger runs if that criteria is met.

Many thanks

ConfusedAgain
Yak Posting Veteran

82 Posts

Posted - 2012-04-17 : 06:06:28
Sorry ignore that:

It does work it was that I forgot to type End at the end of the trigger when modifying.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-17 : 13:26:30
looks like a business logic validation to me
why are doing this inside trigger?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -