PDA

View Full Version : Automatic insert select based on server date?



anessa05
Dec 14th, 2005, 05:13 PM
Hello,

I have an ASP events calendar page with a SQL database of events. I'd like to have events that have past automatically moved to another table within the same database called past based on the server's current date. Is there a way to do this and trigger it perhaps upon loading the events calendar page in the web browser? I currently have to go to SQL Enterprise Manager and manually run two queries...

First...
insert into past (eventId, title, description, ceMonth, day_start, day_end, ceYear, url) from events where ceMonth < '12' and ceYear = '2005';

Then...
delete from events where ceMonth < '12' and ceYear = '2005';

Thanks in advance,
Anessa

Roelf
Dec 21st, 2005, 08:23 AM
in enterprise manager, you can schedule queries to run in a frequency of your choice

anessa05
Dec 21st, 2005, 07:41 PM
Sweet!!! Thanks!