PRB: Using COMPUTE with Converted Columns (70267)
The information in this article applies to:
- Microsoft SQL Server 4.2x
- Microsoft SQL Server 6.0
- Microsoft SQL Server 6.5
- Microsoft SQL Server 7.0
- Microsoft SQL Server 2000 (all editions)
This article was previously published under Q70267 SYMPTOMS
A table contains an integer column. To format the output when you
select data from this column, convert the column to characters
and concatenate a suffix string.
However, SQL Server generates the following error if you add a
COMPUTE COUNT(weight) clause to the query.
Compute clause #1, aggregate expression #1 is not in the select
list. (Msg 411, Level 16, State 2)
CAUSE
For the COMPUTE clause to function properly, the column name must
appear in both the SELECT list and the COMPUTE clause. If a column in
the SELECT list is being converted and/or numerically derived through
a function or formula, the COMPUTE clause must contain an identical
column definition. This behavior is by design.
WORKAROUND
Make the SELECT and COMPUTE clauses match.
Modification Type: | Minor | Last Reviewed: | 2/14/2005 |
---|
Keywords: | kbProgramming KB70267 |
---|
|