AugForums.com

An Acumatica User Group

  • Free
    • Start Here
    • Rolodex
    • Podcast
    • Blog
    • Forums
  • Paid
    • AugSQL
    • GI Course
    • GI Library
    • Consulting
  • Register
Acumatica Forums

By using this website, you agree to our Terms of Use (click here)

Forums
AugSQL
AugSQL
Running SQL Code au...
 
Notifications
Clear all

#AcumaticaTnT Running SQL Code automatically on a Schedule

 
Votes Received: 1

AugSQL
Last Post by Tim Rodman 2 years ago
1 Posts
1 Users
1 Reactions
49 Views
RSS
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
Topic starter
September 28, 2023 9:34 pm
(@timrodman)
Famed Member
Joined: 10 years ago

If you're interested in scheduling SQL code to run on a schedule, then you'll like this post.

You can run any SQL code that you want, but I'm keeping things simple by assuming that all of the SQL logic is in a Stored Procedure, then I'm executing the Stored Procedure on a schedule.

Rather than build a scheduler into AugSQL, we decided to rely on the existing scheduling capabilities in Business Events.

 

1. We need to create a Generic Inquiry that has only 1 record in it. The reason is that we only want to trigger the schedule to refresh once. The GLSetup table only has one record in it so let's use that in our Generic Inquiry.

image
image
image

 

 

2. Let's create a Business Event that uses the Generic Inquiry that we just created. Setting up the Business Event and the Automation Schedule is pretty straightforward:

image
image

 

 

3. Now for the magic. We simply add an Import Scenario to the Business Event. The second screenshot is very simple, but it's very powerful and the "magic" is highlighted with the red arrow in the second screenshot:

image
image

 

 

That's it? Yep, that's it! Simple, but powerful.

If we wanted to, we could add more Import Scenarios to execute additional SQL code snippets on the same schedule.

image

 

 

I'm currently using this technique at a client to essentially build a Data Warehouse within the Acumatica database, with custom tables that store summarized data. I use a Stored Procedure to refresh the data in these tables on a nightly basis. So far, the longest running SQL snippet takes about a minute and a half to run, but it has run reliably. I haven't tested longer-running queries yet to see if they timeout at a certain point.

Charles Craig reacted
Forum Jump:
  Previous Topic
Next Topic  
Forum Information
Recent Posts
Unread Posts
Tags
  • 12 Forums
  • 2,521 Topics
  • 10.9 K Posts
  • 11 Online
  • 2,321 Members
Our newest member: Courtney Wilder
Latest Post: Can UDFs be populated using an Import Scenario?
Forum Icons: Forum contains no unread posts Forum contains unread posts
Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Online Members

 No online members at the moment

Acumatica Forums

Terms of Use & Disclaimers :: Privacy Policy

Copyright © 2025 · AUG Forums, LLC. All rights reserved. This website is not owned, affiliated with, or endorsed by Acumatica, Inc.

‹›×

    ‹›×