Select the product you need help with
FIX: Incorrect results if you use parentheses around SELECT in a statement that has a common table expression in SQL Server 2008Article ID: 2322209 - View products that this article applies to. On This PageSYMPTOMSOn a computer that is running Microsoft SQL Server 2008, consider the following scenarios. Scenario 1You specify a common table expression (CTE) by using the WITH statement. For example, you run the following query.Because of this problem, a performance report may fail when the report assumes that the statement_start_offset value is always smaller than the statement_stop_offset value. Scenario 2You specify a common table expression by using the WITH statement, and you use the RECOMPILE option. For example, you create a function in SQL Server 2008 by using the following script.A severe error occurred on the current command. The results, if any, should be discarded. Additionally, this error can occur without the RECOMPILE option if the SQL server is experiencing heavy server traffic. Scenario 3You specify a common table expression by using the WITH statement. In the WITH statement, you specify a table that does not exist. For example, you run the following query.CAUSEThese problems occur because of a malfunctioning processing of a SELECT statement that follows a WITH statement. The WITH statement uses the following syntax. RESOLUTIONService pack information To resolve this problem, 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
(http://support.microsoft.com/kb/968382/
)
How to obtain the latest service pack for SQL Server 2008WORKAROUNDTo work around these problems, you have to remove the parentheses from the statement that follows the common table expression. For example, consider the following WITH statement that uses such parentheses. STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. This problem was first corrected in SQL Server 2008 Service Pack 2 (SP2). MORE INFORMATIONFor more information about how to use the WITH statement with a common table expression, visit the following MSDN webpage: WITH common_table_expression (Transact-SQL) For more information about sys.dm_exec_query_stats, visit the following MSDN webpage:
(http://msdn.microsoft.com/en-us/library/ms175972.aspx)
sys.dm_exec_query_stats (Transact-SQL)
(http://msdn.microsoft.com/en-us/library/ms189741.aspx)
Properties |


Back to the top








