I would like to know whether it is possible to run a C# console or ASP.NET application periodically.
My purpose is to automatically do the following steps once a month:
1) Query a Source database.
2) Take the result of the query at (1) and manipulate them by using LINQ and C#, for instance by checking if a certain value is already present in the Destination database.
3) Store the derived data in a Destination database.
The application has to run on a Windows Server 2008, the Source database is in a SQL 2005 Server and the Destination database is in a SQL 2008 Server.
I tried to create for instance a SSIS package but it won't do the job since I cannot add any logic.
Anybody has any suggestion?
You should create a Scheduled Task to perform this. Look here: Control Panel -> Administrative Tools -> Task scheduler
And as you stated, yes - a console app is highly recommended.
Edit
I agree with @andynormancx in that SSIS may be a better way to do this; however, it is commonly accepted to create a console app executed by a scheduled task. This is where it comes down to your resources, time, and expertise: it may or may not be worth the effort to learn enough about SSIS to create a package in SqlServer to do what you need. If someone were to give a complete answer using SSIS to perform this task, I would certainly bow to that expertise.
You can create a new Scheduled Task. It would be much easier and you don't have to re-invent the wheel.
You could create a scheduled task that will call your .exe at pre-defined interval.
Go to your control panel and select Scheduled Task and then add scheduled task
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With