102 SQL Origin: Data Last updated 15 Oct 2026

SQL Server: Incorrect syntax near 'x'. (Msg 102)

T-SQL couldn’t parse the statement near the shown token.

Exact message you may see Incorrect syntax near
Seen on: SQL

Meaning

MySQL/PostgreSQL syntax (LIMIT, backticks, ILIKE), missing commas, reserved words, or unsupported features for the compatibility level.

Common causes

  • LIMIT instead of TOP/OFFSET FETCH
  • Backticks instead of [brackets]
  • Reserved words as names
  • Old compatibility level

⚡ Quick fix

  1. Use TOP or OFFSET … FETCH
  2. Quote identifiers with [ ]
  3. Check the database compatibility level

Detailed fix by platform

SQL

  1. SELECT * FROM dbo.Orders ORDER BY Id OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY;

How to diagnose

  1. Token — Which one?
  2. Dialect — Non-T-SQL syntax?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

1064 — MySQL ERROR 1064 (42000): You have an error in your SQL syntax (MySQL)10641136 — MySQL ERROR 1136 (21S01): Column count doesn't match value count at row 1 (SQL)11361222 — MySQL ERROR 1222 (21000): The used SELECT statements have a different number of columns (SQL)12221248 — MySQL ERROR 1248 (42000): Every derived table must have its own alias (SQL)1248245 — SQL Server: Conversion failed when converting the varchar value 'x' to data type int. (Msg 245) (SQL)2452627 — SQL Server: Violation of PRIMARY KEY constraint 'x'. Cannot insert duplicate key in object 'y'. (Msg 2627) (SQL)2627544 — SQL Server: Cannot insert explicit value for identity column in table 'x' when IDENTITY_INSERT is set to OFF. (SQL)544547 — SQL Server: The INSERT statement conflicted with the FOREIGN KEY constraint 'x'. (Msg 547) (SQL)547102

Explore the map of this error Full error map →

🧠 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.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.