Sql-server – the difference between Completion and Success in SQL Server Maintenance Plans

maintenance-planssql server

Using SQL Server 2008/R2 Maintenance Plans to setup some automated backups/cleanups and notifications. One thing that I can't figure out is what is the difference between Success and Completion?

The way I think about it, is that completion doesn't care if the job failed or succeeded, but if it failed, then obviously it didn't complete maybe??

Perhaps its left there in case of scripts where there might not be a way to tell what the actual outcome was, just that the script completed, but this still feels like its the same as success and failed.

I couldn't find much documentation for it either.

Best Answer

The execution result, in your case, success, completion, or failure is a precedence link that can create a relationship between two tasks. From BOL

A precedence link between two tasks establishes a relationship between the tasks. The second task (the dependent task) executes only if the execution result of the first task (the precedent task) matches specified criteria. Typically the execution result specified is Success, Failure, or Completion

If you wanted to say, have your plan execute a statement that was not designed around success or failure you could use completion to establish a relationship and proceed to the next task.

Example: Purge all records of type 'A' from database [ABC], then execute a database backup - You don't care how many records, if any, were found or deleted. Just run the statement. When it is done, back up the database

Example: Reorganize the index's of database [ABC] only after successfully checking the integrity. If the integrity check fails, do not reorganize the index's

Maint. Plans

Precedence Constraints