You can create custom maintenance tasks that run valid SQL commands directly against the Configuration Manager 2007 site database.

Custom SQL commands are very powerful because they directly manipulate the Configuration Manager 2007 site database. Improper SQL commands can corrupt the Configuration Manager 2007 site database. You should secure the Configuration Manager 2007 site database by limiting the Manage SQL Commands Configuration Manager 2007 object security right to the appropriate administrators.

For more information about creating stored procedures, see How to: Create a Stored Procedure (SQL Server Management Studio) at

To create a custom maintenance task

  1. In the Configuration Manager 2007 console, navigate to SQL Commands.
    In the Configuration Manager console, navigate to System Center Configuration Manager / Site Database / Site Management / <site name> / Site Settings / Site Maintenance / SQL Commands.

  2. Right-click SQL Commands, and select New SQL Command.

  3. In the New SQL Command Properties dialog box, enter a name and configure the task:

    • Specify a SQL command. You can specify a single SQL command up to 255 characters or the name of a stored procedure that contains multiple SQL commands.

    • Specify a path and log file name if you want to review the results after the SQL command runs.

    • Specify a schedule for the SQL command.

SQL commands are not validated by Configuration Manager 2007 for syntax. Before you schedule a custom maintenance task, ensure that the SQL command is valid by testing it in SQL Server Management Studio.

See Also