FIX: When you update rows by using a cursor in SQL Server 2008, the update may take a long time to finish

Article translations Article translations
Article ID: 957872 - View products that this article applies to.
Bug #: 50003344 (SQL Hotfix)
Microsoft distributes Microsoft SQL Server 2008 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release.
Expand all | Collapse all

On This Page

SYMPTOMS

In Microsoft SQL Server 2008, you create a cursor. You try to update the cursor by using a statement. The statement includes an ORDER BY clause. When you update rows by using the cursor, the update may take a long time to finish.

This problem also occurs in Microsoft SQL Server 2005. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
955694 FIX: When you update rows by using a cursor in SQL Server 2005, the update may take a long time to finish

RESOLUTION

The fix for this issue was first released in Cumulative Update 1. For more information about how to obtain this cumulative update package for SQL Server 2008, click the following article number to view the article in the Microsoft Knowledge Base:
956717 Cumulative update package 1 for SQL Server 2008
Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
956909 The SQL Server 2008 builds that were released after SQL Server 2008 was released

Additional information

The following sections include important information about the fix.

Steps to enable the fix

In SQL Server Configuration Manager, add the -T4128 startup parameter to the instance of SQL Server. To do this, follow these steps:
  1. In SQL Server Configuration Manager, click SQL Server Services.
  2. In the right pane, right-click SQL Server (instance_name), and then click Properties.
  3. In the Properties dialog box, click the Advanced tab.
  4. On the Advanced tab, locate the Startup Parameters item, and then type -T4128 at the end of the existing value.
    Note Separate the parameter from other parameters by using a semicolon (;).
  5. Click OK, and then close SQL Server Configuration Manager.
  6. Restart the SQL Server 2008 database engine service for the trace flag to take effect.

Issues that the fix addresses

The fix addresses this issue when the following conditions are true:
  • The user is updating by using a cursor. This can be identified from the Showplan by the UPDATE CURSOR operator.
  • Before the execution of a Clustered Index Update statement, a Nested Loop statement is executed. This statement includes a cursor work table (CWT) that is used as a object, together with the Inner Join parameter. Then, the CWT object is used in the Clustered Index Statement as part of the execution plan for the node.
  • There is an ORDER BY clause in the DECLARE CURSOR (or equivalent API) statement. You can only determine this with certainty by verifying the DECLARE CURSOR statement text.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

For more information about what files are changed, and for information about any prerequisites to apply the cumulative update package that contains the hotfix that is described in this Microsoft Knowledge Base article, click the following article number to view the article in the Microsoft Knowledge Base:
956717 Cumulative update package 1 for SQL Server 2008

REFERENCES

For more information about the list of builds that are available after the release of SQL Server 2008, click the following article number to view the article in the Microsoft Knowledge Base:
956909 The SQL Server 2008 builds that were released after SQL Server 2008 was released


For more information about the Incremental Servicing Model for SQL Server, click the following article number to view the article in the Microsoft Knowledge Base:
935897 An Incremental Servicing Model is available from the SQL Server team to deliver hotfixes for reported problems


For more information about the naming schema for SQL Server updates, click the following article number to view the article in the Microsoft Knowledge Base:
822499 New naming schema for Microsoft SQL Server software update packages


For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates

Properties

Article ID: 957872 - Last Review: October 15, 2008 - Revision: 1.0
APPLIES TO
  • Microsoft SQL Server 2008 Enterprise
  • Microsoft SQL Server 2008 Developer
Keywords: 
kbexpertiseadvanced kbqfe kbfix KB957872

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com