Calibration Due and Overdue List SQL Query Generator
Every calibration program needs a reliable list of what is overdue, what falls due soon and what has never been calibrated. This generator writes those queries for a gage master table so you can plug in your own table and column names.
Fill in
Generic name, replace with your table
Overdue gages (PostgreSQL or Oracle date arithmetic)
SELECT g.gage_id,
g.location,
g.last_cal_date + g.cal_interval_days AS due_date,
CURRENT_DATE - (g.last_cal_date + g.cal_interval_days + 0) AS days_overdue
FROM gage_master g
WHERE g.status = 'ACTIVE'
AND g.last_cal_date IS NOT NULL
AND g.last_cal_date + g.cal_interval_days + 0 < CURRENT_DATE
ORDER BY days_overdue DESC;Due within the window
SELECT g.gage_id,
g.location,
g.last_cal_date + g.cal_interval_days AS due_date
FROM gage_master g
WHERE g.status = 'ACTIVE'
AND g.last_cal_date IS NOT NULL
AND g.last_cal_date + g.cal_interval_days >= CURRENT_DATE
AND g.last_cal_date + g.cal_interval_days <= CURRENT_DATE + 30
ORDER BY due_date;Never calibrated
SELECT g.gage_id, g.location FROM gage_master g WHERE g.status = 'ACTIVE' AND g.last_cal_date IS NULL;
SQL Server variant of the overdue test
-- SQL Server uses DATEADD instead of date plus integer
SELECT g.gage_id,
DATEADD(day, g.cal_interval_days, g.last_cal_date) AS due_date
FROM gage_master g
WHERE g.status = 'ACTIVE'
AND DATEADD(day, g.cal_interval_days + 0, g.last_cal_date) < CAST(GETDATE() AS date);Table and column names are generic placeholders. Replace them with those in your ERP, QMS or CMMS, for example your gage or equipment master. Date arithmetic differs by database, and some systems store intervals in months. Test on a copy before scheduling it as a report.
Turn this into an ERP report
Optional: we can review your equipment schema and build an overdue calibration alert.
Optional. The tool and every export work without this. No spam.
How to use it
Enter the table and column names from your database, a due-soon window and an optional grace period. Copy the query that fits your database. The first block lists active gages whose due date, last calibration plus interval plus grace, has passed. The second lists gages coming due. The third finds active gages with no calibration date, a common audit finding.
Design choices that matter
Due dates computed from the last calibration date plus the interval are simple, but many programs use fixed month-end due dates, or a due date stored on the record. If your system stores the next due date, use it directly and drop the arithmetic. Decide whether grace is allowed at all; under ISO/IEC 17025 and ISO 10012 style systems, using an overdue gage is a nonconformance that may require an impact review.
- Filter on status so retired or out-of-service gages do not clutter the list
- Check how your interval is stored: days, months or a calendar rule
- Use the records of the last calibration, not the scheduled date
Using it in an ERP
Many ERP quality or maintenance modules hold calibration data as equipment records with a calibration plan and task. Table names differ by system and version, so look up the real schema before running anything. Run the query against a read-only reporting copy, and confirm the user account has only select access.
Common mistakes
Counting the gage as calibrated when the work order was created rather than when it was completed, ignoring time zones on date columns, and forgetting that a gage failing calibration is not the same as being overdue are frequent errors. Add a join to results if you need to flag out-of-tolerance findings.
Frequently Asked Questions
Will this run in my ERP unchanged?
No. The table and column names are placeholders. Map them to your equipment or gage tables and check the date arithmetic for your database. Treat the output as a starting point and test it first.
How do I handle intervals in months?
Use your database's add-months function, such as ADD_MONTHS in Oracle or DATEADD(month, ...) in SQL Server, and replace the day arithmetic. Month-based intervals avoid drift for calendar-based programs.
Should a grace period be used?
Only if your procedure allows it. Some organisations permit a short grace for non-critical gages with documented approval. For critical or customer-mandated gages, a gage past due is out of use until calibrated.
Can I send this by email each week?
Yes. Most databases and ERP systems can schedule a query and send the results. Include the gage owner so the right person is notified.
If you want these lists as a scheduled report or an alert from your ERP, we can build that against your actual schema.
Related Tools
Gage R&R Python Script Generator (Average and Range)
Fill in the file name, tolerance, and get a plain Python script that computes the average and range gage R&R.
Quality & InspectionMeasurement System and Calibration Audit Checklist
A practical checklist for internal and supplier audits of gage control, calibration records, MSA studies and traceability.
Developer ToolsCalibration Due List SQL Query Generator
Fill in your table and column names and get SQL for overdue, due soon and never-calibrated gages.
Quality & InspectionMeasurement System Maturity Assessment
Ten questions that score how well your calibration, MSA and gage records are controlled, with next-step advice by band.
More Developer Tools tools
See all- OEE SQL Query Generator
- OEE Power BI DAX Measures Generator
- Dimensional Inspection Out-of-Tolerance SQL Query Generator
- SAP Sales Order ABAP SELECT Generator (VBAK, VBAP, VBFA)
- SAP Sales Order Create BAPI ABAP Generator (BAPI_SALESORDER_CREATEFROMDAT2)
- SAP ABAP Open Items SELECT Generator
- SAP ACDOCA SQL Query Generator
- SAP QM Inspection Lot ABAP SELECT Generator
- SAP Quality Notification Pareto SQL Query Generator