Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include an option to create Task Scheduler commands specifically for SQL Express. #853

Open
Imran-imtiaz48 opened this issue Dec 29, 2024 · 0 comments

Comments

@Imran-imtiaz48
Copy link

The current script is designed to create SQL Agent Jobs that execute T-SQL commands. It achieves this by first populating an @Jobs table variable and then creating the jobs based on the data in that table.
For SQL Express, it would be beneficial if the script could automatically generate (or update) .cmd or .bat script files based on the commands in the @Jobs table. Furthermore, adding functionality to generate PowerShell commands to create Task Scheduler tasks for these scripts would enhance usability. This addition would enable the maintenance script to control the default timing and execution of the tasks seamlessly.
Another useful feature could be the option to group commands into sets. Commands within each group could then be executed sequentially. However, this might introduce complications with naming and execution management, so it may be a more advanced enhancement.
Recently, I configured these commands for an instance of SQL Express manually. To achieve this, I adjusted the primary script to generate the data for the @Jobs table and stored it in a persistent table. From there, I manually created the batch files and corresponding Task Scheduler tasks using the stored data. I found this approach easier than deciphering and generating the necessary commands from scratch using documentation.
Alternatively, creating stored procedures to execute command batches could simplify updates and maintenance further. This approach would provide a centralized mechanism for managing the execution flow while keeping the system easier to update over time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants