Incorrect Syntax Near The Keyword ‘Order’

Recently, I was working on a requirement that required me to retrieve data from the Order table in my SQL server database. After executing the Select query, I got the error Incorrect syntax near the keyword.

I was executing the SQL query below.

SELECT * FROM Order;

After executing the above query, I got this error, as shown in the screenshot below.

Incorrect syntax near the keyword 'Order'

Cause of the error

I got this error since the name Order is a reserved keyword in the SQL server, and my table name is Order.

Solution

To solve this error, I had to specify the table name Order within the [ ] bracket to distinguish it from the reserved keyword. The correct, select query is below.

SELECT * FROM [Order];

After executing the above query, I got the expected output below.

Incorrect syntax near the keyword

You may also like to check the below-related errors