Scheduled program VB.NET - vb.net

I would like to ask for a recommendation for my project.
Basically, it's a scheduled program that shall run at a given period of time, for example,
6:00 pm daily, it includes importing an excel file and inserting it in a sql table.
I have my codes with me, but I dont know how to execute this program automatically.
can you give me some advice
I'm using MSSQL2005 server. And VB.NET language.

Build your application to an executable that just does the task once and use Windows task scheduler.

In my old shop, we occassionally forgot about the one-off tasks running under Task SCheduler, but we had lots of SQL Agent jobs running nightly or weekly. So, just to keep things all together, we created SQL Agent jobs for things like this. So my answer is the same as Bala's, but I would trigger the app through a job on SQL Server instead.
How? Take a look at this: http://bp0.blogger.com/_mDuWqJiJyXE/SB6fy1yBRfI/AAAAAAAAATc/bmdxxAfFTjc/s1600-h/JS_Steps1.png

You could use Visual Studio to create windows service which performs the timed actions...it's a steeper learning curve though.

Related

Automating SQL scripts in Toad for Oracle

I'm not a DBA, so bear with me.
I've scheduled tasks through Toad's automation designer, but this uses Windows task scheduler. It's using Oracle 12c.
How can I ensure my scripts execute on time without running a local machine with scheduled tasks? Can this be done without additional software? Thanks in advance.
I don't know what those scripts do.
However, if they can be rewritten into stored procedures, then you could schedule them as database jobs using either DBMS_SCHEDULER (or DBMS_JOB, which is simpler but still quite usable) package.
As a matter of fact, DBMS_SCHEDULER can even run your operating system scripts, using job_type => 'external_script'. Read documentation for more info.
See if it helps.

How to run stored procedure every second automatically (sql server 2014 Express)?

I want to run stored procedure every second automatically.As I am using SQL Server 2014 Express edition so it is not possible to do the same with SQL Server Agent. Also, I don't have any third party tools to do so. I know it can be achieved by using Task Scheduler, sqlcmd utility or by using third-party tools but I don't know the exact way to do that.
I know this can be done and therefore I'm sure it's something I've missed but if anyone can share their experience of this I'd very much appreciate it.
Thanks.
This is a tough one. You're on the right track that you need an outside method to run the job, but I'd recommend writing one yourself to do it if you need the frequency every second (and also question if you really need it every second or not). A service or light application would be the best way to handle it.
I've written an article on setting up Task Scheduler for automated jobs on SQL Server Express, but that has a limit of once/minute. You would use the sqlcmd utility in this case.
You can look at third party utilities like JAMS Scheduler, but their community edition is only free for a year.
That being said, I don't know of any quick-and-easy methods that satisfy your frequency requirements as stated.

Run SQL Process at specific time

I'm trying to build a background process that will check and execute a stored procedure (SQL Server 2008R2) that users will schedule on a UI application. I don't want to create a job, I want to handle it myself. So I was planning to run a check every 2 secs for example and check if there is process that rich the specific time and run it.
Is there any better way to do it?
If you don't want to set up a task within SQL Server, you could write an app that makes the DB call, then schedule that app through Windows Task Scheduler.

Reviewing text of scheduled job - Transact SQL database

I am using only VS2012 Ultimate Server Xplorer Pane to code and execute my job. I used to add a job scheduling to perform some task at specific time.
Now that I realize my executed command implemented is incorrect. I can delete this by making another new query on the database then recreate a new similar job but I don't want to do this.
I don't know how to fix the command text.
Get Management Studio, and stop trying to do this through Visual Studio.
http://www.microsoft.com/en-us/download/details.aspx?id=43351
Download SQLManagementStudio_x64_ENU.exe (unless you are on x86 for some reason, in which case pick the other one). It's ~1GB, not sure why, sorry about that.
Starting with 2012 SP1, Management Studio Express is fully functional with no license requirement (this is the first time this has happened).
Connect to your server, expand SQL Server Agent > Jobs, and double-click your job. Nice enough UI that will let you edit steps, schedules, etc. without doing any of this hokey generate-an-entire-script-for-a-job stuff...

Is it possible to automate MS SQL Server (2005) queries via SQL Server Management Studio?

I have two queries saved on my SQL Server 2005 and I would like to have them running at certain intervals, e.g. every 24 hours. Is there a way to automate these queries and schedule them via SQL Server Management Studio?
You need to use the SQL Server Agent, installed as part of SQL Server. This is the background service that's responsible for running scheduled maintenance and backup tasks.
Expand the SQL Server Agent node in SQL Server Management Studio, you should see a tree node called "Jobs"
Right-clicking this will give you the option to add a new job. Jobs consist of a series of steps to be executed in order, and when you add a new step to your job, you can choose various types of step, including "Transact-SQL Script"
Create a new job, add a single T-SQL step, put the queries that you want to run into the step properties, and then use the "Schedule" option in the Job properties to create a recurring schedule that'll run the job every 24 hours (or whenever).
You can use the SQL Server Agent, which will allow the server to run the script/stored procedure.
You can also use the Windows Task Scheduler, either on the server or on any other server or workstation to schedule isqlw/sqlcmd to execute your script/stored procedure.
Create a job with a step in which you execute your queries; the job can be scheduled at your needs.
At a previous employer the operations department had a task sheduling application. They prefered to use the command line tools that come with sql server to execute jobs (stored procedures) on a scheduled basis. This way the "task scheduling application" could recieve an exit status (pass/fail, ok/error) and hold up dependent jobs.
I'm sorry I don't remember the name of the command line tool, but it was part of the sql server distro. I also do not remember the name of the task scheduling application. It was not the windows task scheduler. It was something enterprise level used to manage the nightly cycle.
Not sure of the scale of your project, but this is another way to go.
SKapsal's comment on a command line tool for executing SQL commands is a reference to osql (for SQL2000) or sqlcmd (for SQL2005+). You could save your script a file and run it from that command line using Windows Task Scheduler or something similar.
SQL Agent is still the preferred solution, however, as it provides GUI controls for job creation, scheduling, logging and viewing job execution history/results.
how to schedule a job for sql query to run daily?
This is similar question with helpful answer.
Covering simple step by step manual.