Home > DeveloperSection > Forums > Syntax error near the keyword order [on hold] in SQL Server
Manoj Bhatt
Manoj Bhatt

Total Post:154

Posted on    September-22-2014 2:50 AM

 Database Database 

 1 Reply(s)
 1014  View(s)
Rate this:

When I execute this query:


   orders.id, orders.order - time, orders.pizza.id,

   orders.pizza.type, orders.pizza-size, orders.quantity,




   permit ON orders.id = pizza.id


   ([username] = @username)


I got an array:

Syntax error near the keyword order

Any clue how to solve this?

Anchal Kesharwani
Anchal Kesharwani

Total Post:10

Posted on    September-22-2014 3:00 AM

hi manoj,

I hope that this is helpful for you.

Since you have no order by clause and the error message is complaining about your statement near the order keyword, I explain that there are two possibilities.

The first is that you've left the s of one of your table specifiers, using order instead of orders, despite your transcription.

The second is that orders.order-time is incorrect, being treated as orders.order - time. In fact, I'd be a little worried by many of your names, including those that have two periods (.) in them. You may want to check if the - and the subsequent . characters should be underscores (_) instead.

You also have a trailing comma after the last column selection (before the from), which is not valid SQL.

Don't want to miss updates? Please click the below button!

Follow MindStick