SQL Server 2003: how can I assign a name to the SUM column ?

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-05-07T14:25:38Z Indexed on 2010/05/07 14:28 UTC
Read the original article Hit count: 160

Filed under:

hi,

how can I assign a column name to the SUM column ?

i.e.

select OwnerUserId, SUM(PostScore)
INTO Experts
from ...

I get this error:

An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.

I guess because the column containing the results of SUM has not name.

thanks

© Stack Overflow or respective owner

Related posts about sql-server