FIX: When you query through a view that uses the ORDER BY clause in SQL Server 2008, the result is still returned in random order
SQL Server 2008Microsoft 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.
SQL Server 2005Microsoft distributes Microsoft SQL Server 2005 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 2005 fix release.
- The issues that are fixed by the hotfix package
- The prerequisites for applying the hotfix package
- Whether you must restart the computer after you apply the hotfix package
- Whether the hotfix package is replaced by any other hotfix package
- Whether you must make any registry changes after you apply the hotfix package
- The files that are contained in the hotfix package
- The SELECT statement uses the TOP (100) PERCENT expression.
- The SELECT statement uses the ORDER BY clause.
However, this behavior is different in Microsoft SQL Server 2000. In SQL Server 2000, the result is returned in the order that is specified in the ORDER BY clause.
SQL Server 2008The 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:
SQL Server 2005Two versions of this hotfix exist. One version is designed to be applied to the release version of SQL Server 2005. The other version is designed to be applied to SQL Server 2005 Service Pack 2 (SP2). If you are running the release version of SQL Server 2005, apply the hotfix that is described in this article (build 1554). If you are running SQL Server 2005 SP2, apply cumulative update package 2 for SQL Server 2005 SP2 (build 3175). If you are running SQL Server 2005 Service Pack 1 (SP1), install SQL Server 2005 SP2, and then apply cumulative update package 2 for SQL Server 2005 SP2 (build 3175). Cumulative update package 2 for SQL Server 2005 SP2 (build 3175) is described in Microsoft Knowledge Base article 936305. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
Hotfix informationA supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.
If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.
Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site: Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.
PrerequisitesYou must have installed the release version of SQL Server 2005 to apply this hotfix.
Restart informationYou must restart the SQL Server service after you apply this hotfix.
Registry informationYou do not have to change the registry after you apply this hotfix.
Actions after you apply this hotfixThis hotfix introduces trace flag 168. After you apply this hotfix, you must enable trace flag 168. For information about how to enable a trace flag in SQL Server 2005, see the "Remark" section of the following Microsoft Developer Network (MSDN) Web site:
To change the compatibility level, follow these steps:
- Open SQL Server Management Studio, and then connect to the instance of SQL Server 2005.
- Right-click the database that contains the view, and then click Properties.
- In the Select a page pane, click Options.
- In the Compatibility level list, select SQL Server 2000 (80).
Hotfix file informationThis hotfix contains only those files that are required to correct the issues that this article lists. This hotfix may not contain all the files that you must have to fully update a product to the latest build.
The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
|File name||File version||File size||Date||Time||Platform|
SQL Server 2008For 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:
SQL Server 2005If you apply this hotfix to SQL Server 2005 before you migrate an application from SQL Server 2000 to SQL Server 2005, this hotfix will make the application work with SQL Server 2005. For example, you expect to obtain the data in a specific sorted order. To do this, you must use the ORDER BY clause in the SELECT statement that you use to query through the view. After you apply this hotfix and migrate the application, you will obtain a sorted query result.
However, this hotfix is only a temporary resolution. After you migrate the application, you must update the application to work correctly with the new behavior in SQL Server 2005.
After you update the application, you can disable trace flag 168 and change the compatibility level of the database back to 90.
Article ID: 926292 - Last Review: 10/08/2011 23:14:00 - Revision: 6.0
- kbautohotfix kbHotfixServer kbfix kbexpertiseadvanced kbqfe KB926292