Home of the AlmostImplementedException

SQL Server: Set query governor cost limit

Sometimes you will have the problem that you execute a long, time consuming query, e.g. in a stored procedure.
In our case we’ve got a maintanance plan that executes a stored procedure to generate statistics everey day.
But for this we will the following error on execution: “The query has been canceled because the estimated cost of this query (%d) exceeds the configured threshold of %d. Contact the system administrator.” (

You can fix this by setting the cost limit to a higher value or zero with the following command:

This command will set the cost limit for the current connection.

Share :

Leave a Reply