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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 trigger after the last record is updated

Author  Topic 

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2010-07-19 : 13:49:43
Hi friends

i have table with a datetime field in it.
a job that runs each day and updates the table . So when the job updates the last record(updates datetime field) , a trigger should initiate that sends a db mail saying the job has completed ... How can i achieve this?

thank you in advance

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-19 : 13:54:36
You should not be doing this in a trigger as a trigger fires for every DML action that the trigger is defined for. Instead, you should add a job step to your job that does the email.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2010-07-19 : 15:47:08
hi tkizer..sorry my previous psot msilead you..actuall its an classic asp appliaction that does the updates..by job i di not mean sql server job it was an asp apllication...sorry for that
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-19 : 15:49:42
It shouldn't be done with a trigger as the trigger isn't going to just fire for the classic asp application. It'll fire for every update. How will the trigger know it's from the classic asp or from normal updates?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2010-07-19 : 17:26:48
thanks for the input tkizer. i will check if the asp application iteslef can do the job of sending email once it completes.
Go to Top of Page
   

- Advertisement -