ID: Q171869
The information in this article applies to:
A CREATE VIEW statement may fail to create the view, and cause message 8120:
Column is invalid in the select list because it is not contained in
either an aggregate function or the GROUP BY clause.
This problem occurs if all of the following conditions are true:
create view viewname
as
select 'x'=substring(x,1,1)
from
tbl1 a
where a.y=(select max(y) from tbl1
where y = a.y)
group by substring(x,1,1)
To work around this problem, do either of the following:
-or-
Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
The SELECT statement works fine outside of the view. The GROUP BY clause, as documented, should accept any aggregate free expression. This problem does not occur on SQL Server build 6.5.201.
Keywords : kbusage SSrvBCP SSrvGen kbbug6.50
Version : 6.5
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: August 1, 1997