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:
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