Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

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

Posted on by 26

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!

  • Suggested answer
    Gearoid Profile Picture
    Gearoid on at
    RE: SQL script that allows me to find out which job queue run into an error

    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]

  • KTA Profile Picture
    KTA 1,200 on at
    RE: SQL script that allows me to find out which job queue run into an error

    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

  • Maddin Profile Picture
    Maddin 26 on at
    RE: SQL script that allows me to find out which job queue run into an error

    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?

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,698 Super User 2024 Season 2 on at
    RE: SQL script that allows me to find out which job queue run into an error

    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

  • Suggested answer
    Gearoid Profile Picture
    Gearoid on at
    RE: SQL script that allows me to find out which job queue run into an error

    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

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans