Link to home
Start Free TrialLog in
Avatar of SIDESHOWBLAH
SIDESHOWBLAHFlag for United States of America

asked on

A way to automate a SQL script in 2008 r2 Express

I have a small SQL 2008 r2 Express setup that has a few tables that I purge from within the management console now, by running a SQL script.  I would like to find a way to automate that to run each night.  Is there a tool in Express to do that or some other tool available to handle this?  Will SQLCMD work for this?  Thanks
ASKER CERTIFIED SOLUTION
Avatar of Leo Torres
Leo Torres
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To automate, you can use powershell cmdlets to access SQL and using windows task scheduler to manage when your powershell script runs.

Scheduling the running of your powershell script.
Schtasks /?
Schtasks /create /?

Express versions do not have SQL agent option to schedule SQL jobs.

There are many examples powershell SQL scripting including creating backups if the DBs.