YosiFZ
YosiFZ

Reputation: 7900

MySql Run sql method every day

In my sql i have two tables: Events History

That have the same columns exactly,and have a column that called date that have DateTime value.

And i want that every day in the night something like 03:00 run a method that move all the expaired expired rows from Events to History.

I understand that there is two ways to do it:

1)build c# service that run every day.

2)add event to MySql that run every day.

What is the better way to do it? and there is any good tutorial for this?

Upvotes: 0

Views: 112

Answers (1)

Jay
Jay

Reputation: 14481

Since you mention .net I assume you run under windows.

  • You might also consider scheduling a task using the windows task scheduler. It's in all versions of windows. If you're using v7 just type 'schedule' into the search area by the start button.
  • You can easily write a powershell script, or use the mysql command line tool, to execute a sql statement of your choice. Use the scheduler to start it when desired.

Upvotes: 1

Related Questions