Matt Elhotiby
Matt Elhotiby

Reputation: 44066

How to schedule a script in SQL Server Express ( without SQL Server Agent )?

Ok so I asked a question yesterday about doing a timed procedure. I got some responses about using SQL Server Agent but i found out that I am using Sql server 2008 express RC and its not available.

Here is my first question and I want to know if there is another tool I can use to do a timed procedure with sql server ....thanks again

Upvotes: 2

Views: 19431

Answers (2)

Remus Rusanu
Remus Rusanu

Reputation: 294307

You can use dialog timers to start activated procedures. This functionality is available on the Express edition. The advantage over an external service, like Windows Scheduler, is that the solution is self contained inside the database. For example you can move the database to a different computer and the timed procedure will still run, on the new computer, once the database is started. An external service requires you to reconfigure the scheduler agent on the new computer.

Upvotes: 3

Mikael Eriksson
Mikael Eriksson

Reputation: 138960

You can use scheduled task (control panel-administrative tools) and start a .cmd/.bat file where you use sqlcmd to execute SP's or run scripts.

sqlcmd is a command line tool. sqlcmd /? will show you what you can do with it.

enter image description here

Here is how you can use sqlcmd to execute a SP called StoredProcName in database YourDatabase on server instance ComputerName\sqlexpress.

sqlcmd -S ComputerName\sqlexpress -E -d YourDatabase -Q "exec StoredProcName"

Read more about Using the sqlcmd Utility here http://msdn.microsoft.com/en-us/library/ms180944.aspx

Read about the Task Scheduler here http://msdn.microsoft.com/en-us/library/aa383614%28v=vs.85%29.aspx.

Upvotes: 3

Related Questions