Tuesday, March 20, 2012

Automatic trigger on a specific time

Hi!

I use SQL Server Express 2005 and would like that a trigger is fired automatically at a specific time. I have been developing a game which has a lot of periods with a start date and an end date. Every time a periode is finished the trigger should add new records for the next periode. The dates of the periodes are already setted at the beginning of the game. For example:

periode startdate enddate
1 23.08.2006, 15:00 24.08.2006, 17:00
2 24.08 .2006, 17:00 25.08.2006, 08:00
and so on

Can anyone help me how to do this? Thanks!

You can create a maintenance job that runs every few hours or every few days and call a stored proc and put your logic in the stored proc.

|||

Hi ndinakar,

thx for your reply!

I know that jobs are an alternative but there are two problems: firstly it seems, that jobs are not available in SQL Server Express Version and secondly the trigger should actually fire on a specific time that could be every minute. So I would have to fire a job every minute but I think, that might not be a good idea.

|||I havent used Express editions. The other alternative is to create a Windows Service and schedule it to run every 1 minute. You could call a stored proc using OSQL. Activate the OSQL from your windows service. Might sound complicated but I cant think of any other option.|||Sounds like what you really want is a windows service like ndinakar mentioned.|||Thx ndinakar and Motley. I`ll try to use a windows service. That might be the best solution.sql

No comments:

Post a Comment