102: Incorrect syntax near 'token'
SQL ServerWhat does it mean?
The Transact-SQL parser found invalid syntax near the specified token and could not compile the statement. The query is rejected before it runs.
Why does it happen?
A typo, a missing comma/parenthesis, a reserved keyword (e.g. USER, ORDER) used without square brackets, an unterminated string literal, or incompatible syntax copied from another SQL dialect. Concatenation mistakes in dynamic SQL are also a frequent trigger.
How to fix it
Inspect the area around the reported token carefully; the error is often on the preceding line. Wrap reserved words in square brackets ([Order]) and check that parentheses and commas balance. If you build dynamic SQL, PRINT @sql to see the generated text and run it. Verify that the syntax is supported by the version/compatibility level.
More from this engine
- 10928Resource limit for the database has been reached (Azure SQL)
- 40544The database has reached its size quota (Azure SQL)
- 40613Database is not currently available (Azure SQL)
- 8114Error converting data type X to Y
- 1204The instance of the SQL Server Database Engine cannot obtain a LOCK resource
- 3906Failed to update database because the database is read-only
- 15023User already exists in the current database