The knowledge base Browse

Slab Manager: Find Slabs Consumed in Last 30 Days

Reference Number: AA-00297 Views: 216 Created: 2018-02-21 10:33 Last Updated: 2018-02-21 10:46

Slab Manager SQL query to find slabs that are consumed in the last 30 days.

You want to know what slabs were consumed over the last 30 days, or another number of days

This is a Slab Manager SQL query. If you want a different number of days, modify the script

DB Versions supported by this script

2015.2 or later

How to run a script

Use the "SQL" button in the Slab Manager.

Copy the script below

declare @dayRange int = 30 --Modify this number to get a different number of days

declare @day DATE = CAST(GETDATE()-@dayRange as DATE)

SELECT (SlabID) FROM [SSSlabBrowser].[All Slabs] join audit.slab on slabid = slabuid

WHERE ([SSSlabBrowser].[All Slabs].[Template] = 0) and Timestamp>=@day and Before='Received' and After='Consumed'
ORDER BY [Audit].[Slab].[Timestamp] desc