Scheduled tasks

SQL Complete has a built-in Command Line Wizard that allows converting the options, such as searching for invalid objects or code formatting, into command-line syntax and saving them as a *.bat file with a script so you can schedule the task using Windows Task Scheduler or any other task scheduler tool.

Scheduling tasks includes the following steps:

Step 1: Create a .bat file using dbForge SQL Complete

Here, we create two batch files using the Command Line Wizard - one for the operation of searching for invalid objects and the other for the operation of formatting the code.

Create a .bat file for the operation with the search for invalid objects

1. Open the Find Invalid Objects window by using one of the following options:

  • Go to the SQL Complete main menu and select Find Invalid Objects.
  • In Object Explorer, right-click the database for which you want to search for invalid objects and select Find Invalid Objects.
  • Press Ctrl+Alt+F.

2. On the toolbar of the window that opens, click Save Command Line to open the Command line execution file settings dialog.

Command Line wizard

3. In the dialog that opens, select the required settings. For full information about the settings, see Command-Line Wizard.

4. Optional: To verify that the command line settings are valid, click Validate.

5. To save the script as a *.bat file, click Save. In the window that opens, specify the file name and click Save.

Create a .bat file for the code formatting operation

1. Go to the SQL Complete main menu and select SQL Formatter to open the SQL Formatter Wizard.

2. In the wizard, select a formatting mode: Files or Directories and click Next.

Command Line wizard

3. On the File list page, click Add to select the files to format and click Save Command Line.

4. In the Command line execution file settings dialog that opens, verify and configure the settings to manage the *.bat file text. For full information about the settings, see Command-Line Wizard.

Command Line wizard

5. Optional: To verify that the command line settings are valid, click Validate.

6. To save the script as a *.bat file, click Save. In the window that opens, specify the file name and click Save.

Step 2: Create a scheduled task using Windows Task Scheduler

After that, you can create a scheduled task using the Windows Task Scheduler so the computer can carry out the task automatically.

To create a scheduled task, do the following:

1. Open the Task Scheduler.

2. In the Task Scheduler window that opens, navigate to the Actions pane and click Create Basic Task to create a scheduled task.

Click Create Basic Task in Windows Task Scheduler

3. In the Create Basic Task Wizard that opens, specify the name and description of the task and click Next.

Specify the name and description

4. On the Trigger page, choose when to launch the task. Depending on the selected option, you’ll need to specify additional details.

  • Schedule based on the calendar: Daily, Weekly, Monthly, or One time. For this, specify the schedule you want to use.
  • Schedule based on common recurring events: When the computer starts or When I log on.
  • Schedule based on specific events: When a specific event is logged. For this, specify the event log, source, and even ID using the dropdown menu.

Select the time period for the task to be started

5. On the Action page, click Start a program to schedule a program to start automatically and then click Next.

Schedule a program to start automatically

6. On the Start a Program page, click Browse to select the .bat file for which you want to create a scheduled task and then click Next.

There are optional fields that you can set:

  • Add arguments: Specify the arguments to run the task with specific instructions.
  • Start in: Specify the folder in which the program will start.

Start a program

7. On the Finish page, verify the settings and click Finish.

Finish the task

The task will be displayed in the Active Tasks section.

View the created task in the Active Tasks section of Task Scheduler

Repeat the instructions from the Step 2 to create a scheduled task to format code.

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge SQL Complete for SQL Server.
All Features

All features

Get acquainted with the rich features and capabilities of the SQL Complete in less than 5 minutes.
Request a demo

Request a demo

If you consider employing the SQL Complete for your business, request a demo to see it in action.
Ready to start using dbForge SQL Complete for SQL Server?