On this page
Why it happens
Error 156 is a close cousin of error 102: both are syntax errors the parser raises before your query runs. The difference is that 156 points specifically at a reserved keyword. The message names the exact word, as in Incorrect syntax near the keyword 'from', so that word marks where the parser gave up.
The most common cause is a reserved word used as a table or column name without brackets. Names like User, Order, Group, From, and Select are reserved, so when the parser meets one it tries to read a clause and fails. Wrapping the name in square brackets tells SQL Server to treat it as an identifier instead.
Other frequent triggers are a missing comma that lets a keyword land where a column was expected, clauses written in the wrong order (for example WHERE before FROM, or a misplaced GROUP BY), and an incomplete statement that ends right before a keyword. Severity 15 marks it as a normal, fixable syntax error, not a server fault.
Examples
A column named User without brackets
-- User is a reserved keyword, so the parser trips on the next word
SELECT User FROM dbo.Accounts;
Msg 156, Level 15, State 1, Line 2 Incorrect syntax near the keyword 'User'.
A missing comma before FROM
-- The comma between name and email is missing, so FROM lands
-- where a column was expected
SELECT name email
FROM dbo.Customers;
Msg 156, Level 15, State 1, Line 3 Incorrect syntax near the keyword 'FROM'.
Clauses in the wrong order
-- WHERE cannot come before FROM
SELECT id, total
WHERE total > 100
FROM dbo.Orders;
Msg 156, Level 15, State 1, Line 4 Incorrect syntax near the keyword 'FROM'.
How to fix it
Wrap reserved words in square brackets
When a reserved word such as User, Order, or Group is a real table or column name, enclose it in square brackets so SQL Server reads it as an identifier rather than a keyword. Renaming the object is a cleaner long-term fix.
-- Bracket the reserved name
SELECT [User] FROM dbo.Accounts;
-- Or rename the column to avoid the keyword entirely
-- EXEC sp_rename 'dbo.Accounts.User', 'UserName', 'COLUMN';
Add the missing comma
If a keyword like FROM is flagged, check the column list right before it. A dropped comma makes two items read as one and pushes the keyword into the wrong place.
SELECT name, email
FROM dbo.Customers;
Put the clauses in the correct order
T-SQL requires a fixed clause order: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY. Reorder the query so each clause follows the one before it.
SELECT id, total
FROM dbo.Orders
WHERE total > 100;
Complete the statement before the keyword
An unfinished expression that stops just before a keyword also triggers 156. Fill in the missing part so the clause is complete.
-- Missing predicate after WHERE caused the keyword to be flagged
SELECT id, total
FROM dbo.Orders
WHERE status = 'open'
GROUP BY id, total;
How to prevent it
Avoid reserved words as table and column names. Keep a reference of the T-SQL reserved keywords handy, and when a name is unavoidable, always bracket it. See the SQL syntax guide for the clause order and quoting rules.
Format queries clearly, with one clause per line, so a missing comma or an out-of-order clause is easy to spot before you run the statement. Working through the SQL tutorial builds the habit of writing clauses in the correct SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY sequence.
Common questions
Which reserved keywords do I need to bracket in SQL Server?
Common reserved words that people accidentally use as names include User, Order, Group, From, Select, Table, Key, Column, Index, Check, Primary, Public, Level, Percent, Rule, Plan, Backup, Restore, Grant, Deny, Revoke, Cursor, Trigger, Function, Procedure, Constraint, Default, Identity, and Value. When any of these is a table or column name, wrap it in square brackets like [User] or [Order], or rename the object. Microsoft publishes the full list of reserved keywords in the T-SQL documentation.
What is the difference between error 156 and error 102?
Both are syntax errors the parser raises before the query runs, and both are severity 15. Error 102 is the general "incorrect syntax near" message and points at any token, such as a stray symbol or misspelled word. Error 156 is the more specific case where the offending token is a reserved keyword, so the message reads "incorrect syntax near the keyword". In practice a missing comma or an unbracketed reserved name often produces 156, while a bad character or typo produces 102.
Why does SELECT User cause error 156?
User is a reserved keyword in T-SQL, so the parser does not read it as a column name. It expects a clause and fails on the next word. Bracket it as [User] or rename the column to fix the error.