207
Product Name Event ID 207 Event Source MSSQLSERVER Component SQLEngine Symbolic Name SQ_BADCOL Message Text Invalid column name '
Product Name
Event ID
207
Event Source
MSSQLSERVER
Component
SQLEngine
Symbolic Name
SQ_BADCOL
Message Text
Invalid column name ’%.*ls’.
This query error can be caused by one of the following problems.
The column name is misspelled or the column does not exist in any of the specified
tables.
The collation of the database is case-sensitive and the case of the column name specified
in the query does not match the case of the column defined in the table. For example,
when a column is defined in a table as
and the database uses a case-sensitive
collation, queries that refer to the column as
or
will cause error 207
to return because the column name does not match.
A column alias, defined in the SELECT clause, is referenced in another clause such as a
WHERE or GROUP BY clause. For example, the following query defines the column alias
in the SELECT clause and refers to it in the GROUP BY clause.
ノ
Expand table
Year
USE AdventureWorks2022;
GO
SELECT DATEPART(yyyy,OrderDate) AS Year, SUM(TotalDue) AS Total