February 29, 2008 at 8:31 am
One week ago I wrote my first stored procedure. Since, that time I have made great progress normalizing a legacy system in SQL Express and have found it extremely interesting. As for the triggers, I have created a log table that has a trigger on it. Now, I can have the trigger fire if a certain field is updated. Is it possible to have the trigger fire, if the field is updated to a certain value.
Thanks for any help
February 29, 2008 at 8:40 am
Sure ....
IF (SELECT 1 FROM inserted WHERE yourField = 'yourTestValue')
BEGIN
-- your trigger code here
END
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgFebruary 29, 2008 at 8:42 am
Sure ....
IF EXISTS (SELECT 1 FROM inserted WHERE yourField = 'yourTestValue')
BEGIN
-- your trigger code here
END
OPPS... EDITED!! I forgot ot add the EXISTS keyword
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgFebruary 29, 2008 at 9:01 am
Genius.....
Thanks man.....
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy