Skip to main content

Notifications

Microsoft Dynamics RMS (Archived)

Not getting results from SQL query

Posted on by 290

Hi,

I'm running the below statement via SO Adminstrator as I want to view the contents of the order table

select * from order;

This statement returns the following error,

An error occurred while executing the query:  Incorrect syntax near the keyword 'order'.

Any clues why?  I can't see anything wrong.

*This post is locked for comments

  • Rob Gresswell Profile Picture
    Rob Gresswell 290 on at
    RE: Not getting results from SQL query

    Putting [ ] round the word fixed the problem.

    Thanks Dann

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Not getting results from SQL query

    [Order] is absolutely a valid table (there are multiple stock reports that query it). It holds customer Quotes/Work Orders/Layaways, and there won't necessarily be a corresponding entry in the [Transaction] table (linked via the RecallID field) until a particular order is processed through POS and completed as a transaction.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Not getting results from SQL query

    order is not a valide table.  

    try   SELECT * FROM [TRANSACTION]

    or   SELECT * FROM [TRANSACTIONENTRY]

    if you have years of history these commands will take a long time to complete.   What information are you trying to retrieve?

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Not getting results from SQL query

    'Order' is a reserved term in SQL, which is why you're getting the error. Put it in []'s, and you'll be fine:

    SELECT * FROM [Order]

    (this is also the case with 'Transaction', fwiw)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,900 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,275 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans