Production.WorkOrder Table

Information

NameWorkOrder
SchemaProduction
Row Count0
Data Size 
Index Size 
Reserved Size 
Unused Size 
Created29.3.2010. 21:58:18
Modified29.3.2010. 21:58:56

Extended Properties

NameTypeProperty NameValue
WorkOrderTABLEMS_DescriptionManufacturing work orders.

Columns

PKKeyIdentityNameData TypeAllow NullsCollationReferencesDefaultComputedCompute Expression
   WorkOrderIDint   
 
 
 
   ProductIDint  Production.Product.ProductID
 
 
 
   OrderQtyint   
 
 
 
   StockedQtyint   
 
 
(isnull([OrderQty]-[ScrappedQty],(0)))
   ScrappedQtysmallint   
 
 
 
   StartDatedatetime   
 
 
 
   EndDatedatetime   
 
 
 
   DueDatedatetime   
 
 
 
   ScrapReasonIDsmallint  Production.ScrapReason.ScrapReasonID
 
 
 
   ModifiedDatedatetime   
(getdate())
 
 

Indexes

NameTypePrimaryUniqueColumns
PK_WorkOrder_WorkOrderIDClustered  WorkOrderID
IX_WorkOrder_ScrapReasonIDNonClustered  ScrapReasonID
IX_WorkOrder_ProductIDNonClustered  ProductID

Check Constraints

NameColumnEnabledTrustedExpression
CK_WorkOrder_EndDate   ([EndDate]>=[StartDate] OR [EndDate] IS NULL)
CK_WorkOrder_OrderQtyOrderQty  ([OrderQty]>(0))
CK_WorkOrder_ScrappedQtyScrappedQty  ([ScrappedQty]>=(0))

Foreign Key Constraints

NameTypeReferenced Table
FK_WorkOrder_Product_ProductIDForeign keyProduction.Product
FK_WorkOrder_ScrapReason_ScrapReasonIDForeign keyProduction.ScrapReason

Triggers

NameActivates onInstead OfFor ReplicationEnabledCreatedModified
iWorkOrderINSERT   29.3.2010. 21:58:5629.3.2010. 21:58:56
uWorkOrderUPDATE   29.3.2010. 21:58:5629.3.2010. 21:58:56

SQL Script

CREATE TABLE [Production].[WorkOrder] (
    [WorkOrderID] int NOT NULL IDENTITY,
    [ProductID] int NOT NULL,
    [OrderQty] int NOT NULL,
    [StockedQty] int NOT NULL,
    [ScrappedQty] smallint NOT NULL,
    [StartDate] datetime NOT NULL,
    [EndDate] datetime NULL,
    [DueDate] datetime NOT NULL,
    [ScrapReasonID] smallint NULL,
    [ModifiedDate] datetime NOT NULL DEFAULT (getdate())
);
CREATE INDEX [IX_WorkOrder_ScrapReasonID] on [Production].[WorkOrder]([ScrapReasonID]);
CREATE INDEX [IX_WorkOrder_ProductID] on [Production].[WorkOrder]([ProductID]);