Symptoms
If you run a query that tries to update a derived table that contains a UNION statement, a handled Access Violation occurs and the connection is closed. For example, the following query:
declare @x intupdate tset @x = coalesce( @x , 0 ) + nfrom ( select 1 union all select 2 union all select 3 ) as t( n ) returns this error message:
ODBC: Msg 0, Level 19, State 1
SqlDumpExceptionHandler: Process 51 generated fatal exception c0000005
EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
Connection BrokenSQL Server also prints a stack dump to the error log with text similar to the following example. Please check the error log for the Access Violation and note that the Exception Address is in (res_view(class CAlgStmt *,class TREE * *):
2000-08-28 12:13:37.77 spid51Error: 0, Severity: 19, State: 02000-08-28 12:13:37.77 spid51SqlDumpExceptionHandler: Process 51 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process..********************************************************************************* BEGIN STACK DUMP:*08/28/00 12:13:37 spid 51**Exception Address = 0067CA0C (res_view(class CAlgStmt *,class TREE * *) + 000003E3 Line 0+00000000)*Exception Code= c0000005 EXCEPTION_ACCESS_VIOLATION*Access Violation occurred reading address 00000000* Input Buffer 256 bytes -*declare @x intupdate tset @x = coalesce( @x , 0 ) + nfrom ( select*1 union all select 2 union all select 3 ) as t( n )**
Resolution
Microsoft has confirmed this to be a problem in SQL Server 2000.