The knowledge base Browse

Find the job a slab belongs to

Reference Number: AA-00257 Views: 4676 Created: 2012-11-19 12:37 Last Updated: 2012-11-19 13:04

Find the job that a particular slab belongs to from the slab's inventory ID.

You know the inventory ID of a slab and you want to know what job it belongs to.

Replace the highlighted text in the script with the slab's inventory ID and run the script

DB Versions supported by this script

v2 beta 9.7 or later

How to run a script

Directions to run a script can be found here.

WARNING! - Scripts may change your database! 

If you are not completely sure that you need what this script can do... do not run it, or call Northwood Designs, Inc. and ask.

Copy the script below

DECLARE @searchSlab nvarchar(32) = N'Slab Inventory ID goes here'

SELECT     MasterSlabView.InventoryID, Jobs.ID, JobItems.Description AS JobDescription, JobItems.State AS JobState
FROM         JobSlabs INNER JOIN
                      MasterSlabView ON JobSlabs.SlabUID = MasterSlabView.SlabID INNER JOIN
                      JobItems ON JobSlabs.JobItemUID = JobItems.JobItemID INNER JOIN
                      Jobs ON JobItems.JobUID = Jobs.JobID
WHERE     (MasterSlabView.InventoryID = @searchSlab)