Excel report using data from MySQL Stored Procedure

I am creating an Excel Report that queries a MySQL database using an ODBC connection. The data is the returned result of a Stored Procedure which contains some pretty slow, resource intensive queries on some massive tables belonging to a VICIDIAL installation.

I need the data to be as fresh as possible — but not at the expense of locking the database. So I need to be able to prevent the Stored Procedure from running during business hours.

So my first attempt involved some simple IF logic:

My second attempt used LEAVE which just seems a bit neater:

And my final refinement using parameters:

A final solution would be to accommodate non-working days (weekends as well as public holidays).

Powered by MySQL logo

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.