Freight TMS SQL Audit Queries (30 Scripts Across 5 Carrier Dialects)
Production-safe, strictly read-only SELECT / CTE diagnostic scripts for motor carriers and freight brokers across Microsoft SQL Server (T-SQL), PostgreSQL, MySQL 8.0+, SAP SQL Anywhere / Sybase ASE, and IBM Db2 for i (AS400). Need custom table substitution for TMWSuite, McLeod, Truckmate, or EXSPEEDITE? Launch the browser-local interactive SQL sandbox on strongtoweronline.com.
Interactive 30-Script Read-Only SQL Explorer
Select a carrier database dialect and audit template to inspect or copy the verified read-only SELECT script directly.
Full 30-File Repository Index
Direct links to every MIT-licensed read-only audit script in stjmelliott/freight-tms-sql-audit-queries.
| # | Audit Template & Operational Objective | Category | Dialect Files |
|---|---|---|---|
| 01 | Unbilled Detention & Accessorial Revenue Leakage Identifies completed pickup and delivery stops whose actual dock dwell exceeded your free-time threshold where detention accessorial lines (DET, DTL, DTU) are missing or under-billed compared to earned dwell hours. |
Revenue Recovery | T-SQL · PostgreSQL · MySQL 8.0+ · Sybase / SQL Anywhere · IBM Db2 for i |
| 02 | Lane Operating Ratio & Deadhead Margin Breakdown Aggregates delivered loads by origin-to-destination state lane to expose high empty-mile deadhead ratios, low revenue per total mile, direct driver and variable load cost, and worst-performing lane operating ratios. |
Lane Margin | T-SQL · PostgreSQL · MySQL 8.0+ · Sybase / SQL Anywhere · IBM Db2 for i |
| 03 | Driver Settlement vs. Dispatch Mileage Variance Audit Reconciles dispatched loaded plus empty miles against settled paid miles before Friday payroll release, flagging variances of at least 25 miles or 5 percent and surfacing duplicate settlement postings on the same load. |
Driver Payroll | T-SQL · PostgreSQL · MySQL 8.0+ · Sybase / SQL Anywhere · IBM Db2 for i |
| 04 | Stale / Missing ANSI X12 EDI 214 Status Exception Finder Cross-checks actual arrival timestamps on EDI-enabled customer loads against the outbound EDI 214 transmission log to surface missing X3/X1 status updates, failed queues, SLA transmission lag over 60 minutes, and overdue 997 acknowledgments. |
EDI X12 SLA | T-SQL · PostgreSQL · MySQL 8.0+ · Sybase / SQL Anywhere · IBM Db2 for i |
| 05 | Fuel Surcharge Peg-Scale Ceiling & Under-Recovery Audit Compares actual billed fuel surcharge per loaded mile against weekly DOE/EIA PADD diesel peg expectations ((DOE_Price - Base_Peg) / MPG_Basis), catching zero-FSC overrides, stale fuel tables, and contract ceilings leaking $0.04/mi or more. |
Fuel Surcharge | T-SQL · PostgreSQL · MySQL 8.0+ · Sybase / SQL Anywhere · IBM Db2 for i |
| 06 | Orphaned Load-Stop & Unposted Freight Bill Integrity Check Runs a unified three-part referential and billing integrity sweep via UNION ALL: orphaned stops missing a load header, delivered loads unposted to the GL after 48 hours, and invoice headers whose net amount disagrees with summed charge lines. |
Referential & AR Integrity | T-SQL · PostgreSQL · MySQL 8.0+ · Sybase / SQL Anywhere · IBM Db2 for i |
Need Custom SQL Tuning, Read Replicas, or Legacy TMS Diagnostics?
Strong Tower Consulting, LLC (Forest City, Iowa · Established July 29, 2008) provides independent SQL Server, PostgreSQL, MySQL, Sybase ASE, and IBM Db2 for i performance tuning, revenue-leakage audits, and read-replica reporting architecture for motor carriers and freight brokerages.