December 28, 2009 at 8:24 am
Hi,
I must to shot a trigger if a field is not null, but I have no idea on how to do that?
Can someone give me a clue?
Best Regards,
December 28, 2009 at 8:26 am
Not sure what you mean.
Triggers fire when data is inserted, update, and/or deleted. Are you looking for a trigger that fires on an insert if a certain row is populated? Or on an update? Or something else?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
December 28, 2009 at 8:29 am
Hi,
Thanks for the reply.
I need to send and e-mail if a field is not null. If on insert or update the field is not null the trigger should fire.
How can I do this?
Sorry for my bad english.
Best Regards,
December 28, 2009 at 9:38 am
what have you tried so far?
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 28, 2009 at 9:53 am
Take a look at "create trigger" in Books Online or on MSDN. It has the syntax for creating triggers. You can use the "inserted" table to select from, and that will tell you if the field is null or not. Then you'll want to have sp_send_dbmail enabled (look that up in BOL/MSDN), and you can use that in the trigger to send the e-mail.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
December 29, 2009 at 7:54 am
Sounds like you first need a course in triggers. Here's an introductory article on triggers[/url] that may help.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply