George K
George K

Reputation: 103

How to execute scripts automatically on SQL Express instances

Servers are SQL Express - about 160 instances. What I need is to execute various scripts(clean tables, backups etc.) on them automatically several times a day. I do not want to use standard Windows Scheduler, as it sometimes just doesn't work. I am looking for a solution maybe free maybe not. Free preferably.

Upvotes: 0

Views: 103

Answers (1)

user7075507
user7075507

Reputation:

I think you will need to run a batch script to get things done.

For the benefit of all, here's a Delete.bat

ECHO Executing Job
ECHO.
PAUSE
sqlcmd -S "london-sql\sqlexpress" -E -Q "exec London.dbo.DeleteAll"
ECHO Job execution Completed
PAUSE
CLS
EXIT

(‘london-sql\sqlexpress’ is the name of the server)

The Load.dat is almost identical, except '"exec London.dbo.LoadAll"'

Call the batch script with Windows Scheduler.

http://www.howtogeek.com/school/using-windows-admin-tools-like-a-pro/lesson2/all/

Upvotes: 1

Related Questions