Transact sql error message Msg 8120 Level 16 - Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Msg 8120 Level 16 Example:
Invalid select:
USE model;
GO
SELECT MAX(id), first_name, last_name FROM students;
GO
Message |
---|
Msg 8120, Level 16, State 1, Line 1 |
Column 'students.first_name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. |
Correct select:
USE model;
GO
SELECT MAX(id), first_name, last_name FROM students
GROUP BY first_name, last_name;
GO
Other error messages:
- Cannot drop the table
- Is not a constraint
- Create View or Function failed because no column name was specified
- Cannot define PRIMARY KEY constraint on nullable column in table
- String or binary data would be truncated
- The database name component of the object qualifier must be the name of the current database
- No item by the name of '%' could be found in the current database.