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 2000 Forums
 Transact-SQL (2000)
 Trigger

Author  Topic 

Underdog
Starting Member

1 Post

Posted - 2004-05-03 : 14:52:44
problem:
(i'll try 2 make it short )

i have a table with columns ExpiryDate(date) and Approved(bit) (among others)
i need to check if Today() <= ExpiryDate
if this is false table has to be updated -> approved has to become 0 AND an e-mail has to be sent
(email is also part of my table)

now i understand that i need to make a trigger of some sort that checks the ExpiryDate every day
i'm not really that familiar with triggers you see

Thnx in advance

gwhiz
Yak Posting Veteran

78 Posts

Posted - 2004-05-03 : 14:57:16
Actually I don't think you'll be able to do this in a trigger. If I understand what you want to do correctly, to once a day run through and update the approved column based on the date compared with ExpiryDate. I would set up a stored procedure to do this and the schedule this in a job to run once a day or more if needed.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-05-03 : 14:58:00
Why do you want to do this in a trigger?

Tara
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-05-03 : 14:59:17
Well...the trigger will fire on either an insert, update or a delete

If you want to run the process once a day, you need to set up a stored procedure and a scheduled job.



Brett

8-)
Go to Top of Page
   

- Advertisement -