ALLINSIGHT

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.” (http://msdn.microsoft.com/en-us/library/aa337374.aspx)

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.
http://msdn.microsoft.com/en-us/library/ms176100.aspx

Share :

Leave a Reply

Your email address will not be published. Required fields are marked *