Tables SQL 2005 Adventure Works OLTP

Production.WorkOrder

Object type: Table

Manufacturing work orders.

Columns 

Name  Data type  Nullable  Description 
WorkOrderID  int  No Column has identity seed value of 1 with a step value of 1.
Primary key for WorkOrder records. 
ProductID  int  No Product identification number. Foreign key to Product.ProductID. 
OrderQty  int  No Product quantity to build. 
StockedQty  ISNULL([OrderQty] - [ScrappedQty], 0)  Yes Quantity built and put in inventory. 
ScrappedQty  smallint  No Quantity that failed inspection. 
StartDate  datetime  No Work order start date. 
EndDate  datetime  Yes Work order end date. 
DueDate  datetime  No Work order due date. 
ScrapReasonID  smallint  Yes Reason for inspection failure. 
ModifiedDate  datetime  No Default value: GETDATE()
Date and time the record was last updated. 

Constraints 

Name  Type  Columns  Description 
DF_WorkOrder_ModifiedDate  DEFAULT  ModifiedDate  Value: GETDATE()
Default constraint value of GETDATE() 
CK_WorkOrder_OrderQty  CHECK  N/A  Value: ([OrderQty] > 0)
Check constraint [OrderQty]>(0) 
CK_WorkOrder_ScrappedQty  CHECK  N/A  Value: ([ScrappedQty] >= 0)
Check constraint [ScrappedQty]>=(0) 
CK_WorkOrder_EndDate  CHECK  N/A  Value: (([EndDate] >= [StartDate]) OR ([EndDate] IS NULL) )
Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL 
PK_WorkOrder_WorkOrderID  PRIMARY KEY  WorkOrderID  Clustered index created by a primary key constraint. 
FK_WorkOrder_Product_ProductID  FOREIGN KEY  ProductID  Reference table: Production.Product
Foreign key constraint referencing Product.ProductID. 
FK_WorkOrder_ScrapReason_ScrapReasonID  FOREIGN KEY  ScrapReasonID  Reference table: Production.ScrapReason
Foreign key constraint referencing ScrapReason.ScrapReasonID. 

Indices 

Name  Description 
IX_WorkOrder_ProductID  Nonclustered index. 
IX_WorkOrder_ScrapReasonID  Nonclustered index. 

Triggers 

Name  Description 
Production.iWorkOrder  AFTER INSERT trigger that inserts a row in the TransactionHistory table. 
Production.uWorkOrder  AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table. 

Linked tables 

Name  Description 
Production.WorkOrderRouting  Work order details. 

Modified by 

Name  Description 
Production.uWorkOrder  AFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table. 

Applies to

Tables | User
The AdventureWorks database sample was developed by Microsoft Corporation, copyright 2005. SQL Server is a trademark of Microsoft Corporation

Document was prepared on: Thursday, April 05, 2007
Help compiled by DBDocumentor, a Pikauba Software product. All rights reserved.