SQL Server: Invalid column name 'x'. (Msg 207)

SQL Server can’t find the column — typo, missing migration, or a string in double quotes with QUOTED_IDENTIFIER ON.

Seen on: SQL

Meaning

Double-quoted text is an identifier when QUOTED_IDENTIFIER is ON. Column aliases also can’t be used in WHERE.

Common causes

  • Typo or missing column
  • String literal in double quotes
  • Using a SELECT alias in WHERE

⚡ Quick fix

  1. Use single quotes for strings
  2. Run migrations
  3. Repeat the expression or use a CTE instead of the alias in WHERE

Detailed fix by platform

SQL

  1. WITH t AS (SELECT price * qty AS total FROM lines) SELECT * FROM t WHERE total > 100;

How to diagnose

  1. Column — Exists?
  2. Quotes — Double-quoted string?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.