A bat script to run all the sql/t-sql scripts in a specific folder.
- Using SQLCMD for running the scripts.
- Logging the results of your sql to a file per script.
- Input for scripts and log folders.
- Beginning and end times for each script.
- Check if the folders exist
- Total running duration of each script saved in the logs.
- Create a empty .bat or .cmd and copy and paste the code in it.
- Change your machine and instance name(for clusters) for single instance you just need your machine name.
- Put your credentials(if needed)
- Run the script, you will be prompt with the scripts and logs paths(can be the same).
- Just wait...the bat will do the rest 🙂
There are other scripts out there that can do this, this just one more, simple and working.
Use and abuse.