Microsoft KB Archive/907864

= Error message when you use the CREATE TABLE statement to create a temp table and you use the CREATE SCHEMA statement in the same batch in SQL Server 2005: &quot;CREATE SCHEMA failed due to previous errors&quot; =

Article ID: 907864

Article Last Modified on 11/20/2007

-

APPLIES TO


 * Microsoft SQL Server 2005 Express Edition
 * Microsoft SQL Server 2005 Standard Edition
 * Microsoft SQL Server 2005 Workgroup Edition
 * Microsoft SQL Server 2005 Developer Edition
 * Microsoft SQL Server 2005 Enterprise Edition
 * Microsoft SQL Server 2005 Standard X64 Edition
 * Microsoft SQL Server 2005 Enterprise X64 Edition
 * Microsoft SQL Server 2005 Standard Edition for Itanium-based Systems
 * Microsoft SQL Server 2005 Enterprise Edition for Itanium-based Systems
 * Microsoft SQL Server 2005 Service Pack 1
 * Microsoft SQL Server 2005 Express Edition with Advanced Services

-



Bug #: 20011065 (SQLBUDT)



SYMPTOMS
Consider the following scenario. In Microsoft SQL Server 2005, you use the CREATE TABLE statement to create a temp table. In the same batch, you use a CREATE SCHEMA statement. In this scenario, you receive the following error message:

Msg 2759, Level 16, State 0, Line 2

CREATE SCHEMA failed due to previous errors.

Msg 0, Level 20, State 0, Line 0

A severe error occurred on the current command. The results, if any, should be discarded.

Additionally, you receive an error message that resembles the following in the Results window in Query Editor:

SqlDumpExceptionHandler: Process 52 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.

For more information about how to view the SQL Server error log, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/library/ms187885.aspx



CAUSE
This problem occurs because the CREATE TABLE statement and the CREATE SCHEMA statement are in the same batch. You experience this problem when the CREATE TABLE statement creates a temp table.



WORKAROUND
To work around this problem, separate the temp table creation and the schema creation in different batches. For example, the following code example causes the problem. CREATE SCHEMA rrr CREATE TABLE rrr.#ttt (c1 int) GO To work around this problem, change the code to resemble the following code example. CREATE TABLE rrr.#ttt (c1 int) GO CREATE SCHEMA rrr GO



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.

Keywords: kbtshoot kbbug kbsql2005engine KB907864

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.