FIX: Select with ANSI Joins Against View with Union Operator and ANSI Joins Fails with Error 4409

Article translations Article translations
Article ID: 218834 - View products that this article applies to.
This article was previously published under Q218834
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 18623 (SQLBUG_65)
Expand all | Collapse all

SYMPTOMS

A SELECT statement, using ANSI-standard joins against a view defined using ANSI-standard joins and the UNION operator, may fail with this error:
Msg 4409, Level 20, State 1
The columns in the query definition and the view definition do not match.
The error occurs with SQL Server Service pack 5, build 6.50.416.

WORKAROUND

Here are three workarounds:
  • Change the query to use TSQL join syntax.

    -or-
  • Change the view definition to use TSQL join syntax.

    -or-
  • Remove the UNION operator from the view definition.

STATUS

Microsoft has confirmed this to be a problem in SQL Server version 6.5. This problem has been corrected in the Post Service Pack 5a Update for Microsoft SQL Server version 6.5. To install the Post Service Pack 5a Update, you must have either SQL Server 6.5 SP5 or SP5a installed.

For information about how to download and install the SQL Server 6.5 Service Pack 5a, refer to the following article in the Microsoft Knowledge Base:
197177 INF: How to Obtain SQL Server 6.5 Service Pack 5a
If you already have SQL Server 6.5 SP5 or SP5a installed, you can download the Post SP5a Update from the following article in the Microsoft Knowledge Base:
274036 INF: How to Obtain SQL Server 6.5 Post Service Pack 5a Update
For more information, contact your primary support provider.

MORE INFORMATION

The following scenario demonstrates this problem:
CREATE TABLE dbo.Assignment (
BUID int NULL 
)
GO

CREATE TABLE dbo.Project (
ProjectID int NULL ,
BUID int NULL
)
GO

CREATE TABLE dbo.ProjectActual (
ProjectID int NULL 
)
GO

CREATE VIEW V_UpdateProject AS
SELECT Project.ProjectID
FROM Project INNER JOIN Assignment ON Project.BUID = Assignment.BUID
UNION 
SELECT Project.ProjectID
FROM Project
GO

SELECT V_UpdateProject.ProjectID
FROM V_UpdateProject
INNER JOIN ProjectActual ON V_UpdateProject.ProjectID = ProjectActual.ProjectID 
go
				
The query fails with this error:
Msg 4409, Level 20, State 1
The columns in the query definition and the view definition do not match.

Properties

Article ID: 218834 - Last Review: October 14, 2013 - Revision: 4.0
APPLIES TO
  • Microsoft SQL Server 6.5 Service Pack 5a
Keywords: 
kbnosurvey kbarchive kbbug kbfix KB218834

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com