Northwind Database (Document! X Sample)
Production.WorkOrderRouting Table
AdventureWorks Database > Production Schema : Production.WorkOrderRouting Table
Description
Work order details.
Properties
Creation Date27/10/2017 14:33
File GroupPRIMARY
Text File Group
System Object
Published for Replication
Rows67131
Data Space Used5,568.00 KB
Index Space Used1,288.00 KB
Columns
 Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
Primary Key Primary key. Foreign key to WorkOrder.WorkOrderID.Integer4   
Primary Key Primary key. Foreign key to Product.ProductID.Integer4   
Primary Key Primary key. Indicates the manufacturing process sequence.SmallInt2   
 Manufacturing location where the part is processed. Foreign key to Location.LocationID.SmallInt2   
 Planned manufacturing start date.DBTimeStamp4   
 Planned manufacturing end date.DBTimeStamp4   
 Actual start date.DBTimeStamp4  
 Actual end date.DBTimeStamp4  
 Number of manufacturing hours used.Numeric9 (9,4)  
 Estimated manufacturing cost.Currency8   
 Actual manufacturing cost.Currency8  
 Date and time the record was last updated.DBTimeStamp4 
(getdate())
 
Indexes
IndexDescriptionPrimaryUnique
Nonclustered index.  
Primary key (clustered) constraint
Check Constraints
NameDescriptionExpression
Check constraint [ActualCost] > (0.00)
([ActualCost]>(0.00))
Check constraint [ActualEndDate] >= [ActualStartDate] OR [ActualEndDate] IS NULL OR [ActualStartDate] IS NULL
([ActualEndDate]>=[ActualStartDate] OR [ActualEndDate] IS NULL OR [ActualStartDate] IS NULL)
Check constraint [ActualResourceHrs] >= (0.0000)
([ActualResourceHrs]>=(0.0000))
Check constraint [PlannedCost] > (0.00)
([PlannedCost]>(0.00))
Check constraint [ScheduledEndDate] >= [ScheduledStartDate]
([ScheduledEndDate]>=[ScheduledStartDate])
Relationships
RelationshipDescription
Foreign key constraint referencing Location.LocationID.
Foreign key constraint referencing WorkOrder.WorkOrderID.
Objects that Production.WorkOrderRouting depends on
 Database ObjectObject TypeDescriptionDep Level
dbo.ErrorLog tabledbo.ErrorLogTableAudit table tracking errors in the the AdventureWorks database that are caught by the CATCH block of a TRY...CATCH construct. Data is inserted by stored procedure dbo.uspLogError when it is executed from inside the CATCH block of a TRY...CATCH construct.3
dbo.Flag datatypedbo.FlagUser Defined Data Type 3
Production.Location tableProduction.LocationTableProduct inventory and manufacturing locations.1
Production.Product tableProduction.ProductTableProducts sold or used in the manfacturing of sold products.2
Production.ProductCategory tableProduction.ProductCategoryTableHigh-level product categorization.4
Production.ProductModel tableProduction.ProductModelTableProduct model classification.3
Production.ProductSubcategory tableProduction.ProductSubcategoryTableProduct subcategories. See ProductCategory table.3
Production.ScrapReason tableProduction.ScrapReasonTableManufacturing failure reasons lookup table.2
Production.TransactionHistory tableProduction.TransactionHistoryTableRecord of each purchase order, sales order, or work order transaction year to date.2
Production.UnitMeasure tableProduction.UnitMeasureTableUnit of measure lookup table.3
dbo.uspLogError proceduredbo.uspLogErrorStored ProcedureLogs error information in the ErrorLog table about the error that caused execution to jump to the CATCH block of a TRY...CATCH construct. Should be executed from within the scope of a CATCH block otherwise it will return without inserting error information.2
dbo.uspPrintError proceduredbo.uspPrintErrorStored ProcedurePrints error information about the error that caused execution to jump to the CATCH block of a TRY...CATCH construct. Should be executed from within the scope of a CATCH block otherwise it will return without printing any error information.2
Production.WorkOrder tableProduction.WorkOrderTableManufacturing work orders.1
SQL
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [Production].[WorkOrderRouting](
    [WorkOrderID] [int] NOT NULL,
    [ProductID] [int] NOT NULL,
    [OperationSequence] [smallint] NOT NULL,
    [LocationID] [smallint] NOT NULL,
    [ScheduledStartDate] [datetime] NOT NULL,
    [ScheduledEndDate] [datetime] NOT NULL,
    [ActualStartDate] [datetime] NULL,
    [ActualEndDate] [datetime] NULL,
    [ActualResourceHrs] [decimal](9, 4) NULL,
    [PlannedCost] [money] NOT NULL,
    [ActualCost] [money] NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_WorkOrderRouting_WorkOrderID_ProductID_OperationSequence] PRIMARY KEY CLUSTERED 
(
    [WorkOrderID] ASC,
    [ProductID] ASC,
    [OperationSequence] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

ALTER TABLE [Production].[WorkOrderRouting] ADD  CONSTRAINT [DF_WorkOrderRouting_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]
ALTER TABLE [Production].[WorkOrderRouting]  WITH CHECK ADD  CONSTRAINT [FK_WorkOrderRouting_Location_LocationID] FOREIGN KEY([LocationID])
REFERENCES [Production].[Location] ([LocationID])
ALTER TABLE [Production].[WorkOrderRouting] CHECK CONSTRAINT [FK_WorkOrderRouting_Location_LocationID]
ALTER TABLE [Production].[WorkOrderRouting]  WITH CHECK ADD  CONSTRAINT [FK_WorkOrderRouting_WorkOrder_WorkOrderID] FOREIGN KEY([WorkOrderID])
REFERENCES [Production].[WorkOrder] ([WorkOrderID])
ALTER TABLE [Production].[WorkOrderRouting] CHECK CONSTRAINT [FK_WorkOrderRouting_WorkOrder_WorkOrderID]
ALTER TABLE [Production].[WorkOrderRouting]  WITH CHECK ADD  CONSTRAINT [CK_WorkOrderRouting_ActualCost] CHECK  (([ActualCost]>(0.00)))
ALTER TABLE [Production].[WorkOrderRouting] CHECK CONSTRAINT [CK_WorkOrderRouting_ActualCost]
ALTER TABLE [Production].[WorkOrderRouting]  WITH CHECK ADD  CONSTRAINT [CK_WorkOrderRouting_ActualEndDate] CHECK  (([ActualEndDate]>=[ActualStartDate] OR [ActualEndDate] IS NULL OR [ActualStartDate] IS NULL))
ALTER TABLE [Production].[WorkOrderRouting] CHECK CONSTRAINT [CK_WorkOrderRouting_ActualEndDate]
ALTER TABLE [Production].[WorkOrderRouting]  WITH CHECK ADD  CONSTRAINT [CK_WorkOrderRouting_ActualResourceHrs] CHECK  (([ActualResourceHrs]>=(0.0000)))
ALTER TABLE [Production].[WorkOrderRouting] CHECK CONSTRAINT [CK_WorkOrderRouting_ActualResourceHrs]
ALTER TABLE [Production].[WorkOrderRouting]  WITH CHECK ADD  CONSTRAINT [CK_WorkOrderRouting_PlannedCost] CHECK  (([PlannedCost]>(0.00)))
ALTER TABLE [Production].[WorkOrderRouting] CHECK CONSTRAINT [CK_WorkOrderRouting_PlannedCost]
ALTER TABLE [Production].[WorkOrderRouting]  WITH CHECK ADD  CONSTRAINT [CK_WorkOrderRouting_ScheduledEndDate] CHECK  (([ScheduledEndDate]>=[ScheduledStartDate]))
ALTER TABLE [Production].[WorkOrderRouting] CHECK CONSTRAINT [CK_WorkOrderRouting_ScheduledEndDate]
See Also

Related Objects

Production Schema
AdventureWorks Database