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
 Other SQL Server Topics (2005)
 Creating trigger on date and time

Author  Topic 

anilkumar.forum
Starting Member

5 Posts

Posted - 2009-05-30 : 01:20:58
Hi Everyone,

I have a table with 4 columns. One of the column is time interval which stores the date and time. My requirement is the moment system time reaches one of the rowns of time interval,a trigger should raise automatically. How can i achieve this??

With Best Regards
Anil Kumar

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2009-05-30 : 02:23:36
It sounds like you should be doing this in a client app, but you could do it in SQL code. Select the first date/time that is after the current date and time and store the value in a variable then issue a WAITFOR TIME statement using the variable. The code will sit waiting until the time comes.
Go to Top of Page

SQLRatankalwa
Starting Member

42 Posts

Posted - 2009-06-02 : 03:11:23
If you do not want to do it using the app. You can start a SQL Server Agent Job which runs every 1 minute or you can set the duration and execute a stored procedure which actually does the required update.


Ratan Kalwa
SQL Server Professionals User Group

http://www.revalsys.com
Go to Top of Page
   

- Advertisement -