FIX: Incorrect results or constraint violation when you run a SELECT or DML statement that uses the row_number function and a parallel execution plan in SQL Server 2008

Article translations Article translations
Article ID: 2589980 - View products that this article applies to.
Expand all | Collapse all
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.

SYMPTOMS

Consider the following scenario:
  • You run a parallel query that uses the row_number function in Microsoft SQL Server 2008.
  • You try to run the query by using a subquery that is inside a SELECT statement or a Data Manipulation Language (DML) statement.
In this scenario, you encounter one of the following issues:
  • You receive incorrect results if you run the query inside the SELECT statement many times.
  • The table might contain incorrect data if the query runs inside a DML statement. If the table has constraints, the statement might fail with a constraint violation.

    For example, an INSERT statement might fail and a primary key violation error occurs if the table has a primary key.


Note These issues might occur in one of the following situations:
  • You set the MAXDOP query hint option to a value that is greater than 2.
  • You set the Max Degree of Parallelism option to a value that is greater than 2 in server configuration.

RESOLUTION

To resolve this issue, obtain the latest service pack for SQL Server 2008. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

968382 How to obtain the latest service pack for SQL Server 2008

WORKAROUND

To work around this issue, use one of the following methods:
  • Enable 4134 trace flag if you have applied one of the following updates:
    • Cumulative update package 6 for SQL Server 2008 or a later cumulative update package for SQL Server 2008
    • Cumulative update package 2 for SQL Server 2008 Service Pack 1 (SP1) or a later cumulative update package for SQL Server 2008 SP1


    For more information about how to enable trace flags, visit the following MSDN website:
    How to enable trace flags
  • Reference the "Workaround" section in the Microsoft Knowledge Base article 970198. 

    For more information, click the following article number to view the article in the Microsoft Knowledge Base:
    970198 FIX: You receive an incorrect result when you run a query that uses the row_number function in SQL Server 2008

Properties

Article ID: 2589980 - Last Review: August 22, 2011 - Revision: 1.0
APPLIES TO
  • Microsoft SQL Server 2008 Developer
  • Microsoft SQL Server 2008 Enterprise
  • Microsoft SQL Server 2008 Enterprise Evaluation
  • Microsoft SQL Server 2008 Express
  • Microsoft SQL Server 2008 Express with Advanced Services
  • Microsoft SQL Server 2008 Service Pack 1
  • Microsoft SQL Server 2008 Service Pack 2
  • Microsoft SQL Server 2008 Standard
  • Microsoft SQL Server 2008 Standard Edition for Small Business
  • Microsoft SQL Server 2008 Web
  • Microsoft SQL Server 2008 Workgroup
Keywords: 
kbqfe kbfix kbexpertiseadvanced kbsurveynew KB2589980

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