web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

SQL script that allows me to find out which job queue run into an error

(0) ShareShare
ReportReport
Posted on by 30

Hello guys,

I would like to know if anyone of you has a SQL script that allows me to find out which job queue in which of my clients has just run into an error?

I use NAV 2017 and have 15 clients there.

It happens from time to time that a job queue runs into an error.

When this happens, I always have to go to all the clients and see where the error occurred.

Unfortunately, this is very time-consuming.

Do you use a script for this?

Thank you very much!

I have the same question (0)
  • Suggested answer
    Gearoid Profile Picture
    on at

    Hi Maddin,

    Maybe this can help as a starting point:

    SELECT TOP (1000) [timestamp]

         ,[User ID]

         ,[Start Date_Time]

         ,[End Date_Time]

         ,[Object Type to Run]

         ,[Object ID to Run]

         ,[Status]

         ,[Description]

         ,[Error Message]

         ,[Processed by User ID]

     FROM [dbo].[CRONUS International Ltd_$Job Queue Log Entry]

     where Status <> 0

  • Suggested answer
    YUN ZHU Profile Picture
    95,712 Super User 2025 Season 2 on at

    Hi, Gearóid gives a good example of this. Just to add a little bit of information, you can find the specific table by the following method and then query it according to the conditions.

    pastedimage1657671015410v1.png

    pastedimage1657671178452v2.png

    Hope this helps as well.

    Thanks.

    ZHU

  • Maddin Profile Picture
    30 on at

    Thank you very much for your great support ;) I have now adapted the script a little and so far I like the result very much.

    Do you know if it is possible to combine the tables of the different companies behind the FROM somehow?

    For example, I have two companies TEST and REAL.

    Now I would formulate the statement for TEST and REAL like this:

    FROM [dbo].[TEST$Job Queue Log Entry] or

    FROM [dbo].[REAL$Job Queue Log Entry]

    But I get an error message when I try to do this:

    FROM [dbo].[TEST$Job Queue Log Entry], [dbo].[REAL$Job Queue Log Entry].

    With this I hope that I only have to run one script for all my companies and not one script per company.

    Is this possible?

  • KTA Profile Picture
    1,200 on at

    it should be. You can declare a text variable and set it with they name of the company in a loop in companies table, then use than variable in the from

  • Suggested answer
    Gearoid Profile Picture
    on at

    Hi Maddin,

    You could also consider using the TSQL "UNION ALL" operator to combine the results from your TEST and REAL JQE tables into a single result set, e.g: 

    SELECT TOP (1000) [timestamp]
    ,'TEST' as [JQ Name]
    ,[User ID]
    ,[Start Date_Time]
    ,[End Date_Time]
    ,[Object Type to Run]
    ,[Object ID to Run]
    ,[Status]
    ,[Description]
    ,[Error Message]
    ,[Processed by User ID]
    FROM [dbo].[TEST$Job Queue Log Entry]
    union all
    SELECT TOP (1000) [timestamp]
    ,'REAL' as [JQ Name]
    ,[User ID]
    ,[Start Date_Time]
    ,[End Date_Time]
    ,[Object Type to Run]
    ,[Object ID to Run]
    ,[Status]
    ,[Description]
    ,[Error Message]
    ,[Processed by User ID]
    FROM [dbo].[REAL$Job Queue Log Entry]

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,606

#2
YUN ZHU Profile Picture

YUN ZHU 931 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans