Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics RMS (Archived)

Not getting results from SQL query

(0) ShareShare
ReportReport
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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans