Production.TransactionHistory Table

Information

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

Extended Properties

NameTypeProperty NameValue
TransactionHistoryTABLEMS_DescriptionRecord of each purchase order, sales order, or work order transaction year to date.

Columns

PKKeyIdentityNameData TypeAllow NullsCollationReferencesDefaultComputedCompute Expression
   TransactionIDint   
 
 
 
   ProductIDint  Production.Product.ProductID
 
 
 
   ReferenceOrderIDint   
 
 
 
   ReferenceOrderLineIDint   
((0))
 
 
   TransactionDatedatetime   
(getdate())
 
 
   TransactionTypenchar(1) SQL_Latin1_General_CP1_CI_AS 
 
 
 
   Quantityint   
 
 
 
   ActualCostmoney   
 
 
 
   ModifiedDatedatetime   
(getdate())
 
 

Indexes

NameTypePrimaryUniqueColumns
PK_TransactionHistory_TransactionIDClustered  TransactionID
IX_TransactionHistory_ProductIDNonClustered  ProductID
IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineIDNonClustered  ReferenceOrderID, ReferenceOrderLineID

Check Constraints

NameColumnEnabledTrustedExpression
CK_TransactionHistory_TransactionTypeTransactionType  (upper([TransactionType])='P' OR upper([TransactionType])='S' OR upper([TransactionType])='W')

Foreign Key Constraints

NameTypeReferenced Table
FK_TransactionHistory_Product_ProductIDForeign keyProduction.Product

SQL Script

CREATE TABLE [Production].[TransactionHistory] (
    [TransactionID] int NOT NULL IDENTITY,
    [ProductID] int NOT NULL,
    [ReferenceOrderID] int NOT NULL,
    [ReferenceOrderLineID] int NOT NULL DEFAULT ((0)),
    [TransactionDate] datetime NOT NULL DEFAULT (getdate()),
    [TransactionType] nchar(1) NOT NULL,
    [Quantity] int NOT NULL,
    [ActualCost] money NOT NULL,
    [ModifiedDate] datetime NOT NULL DEFAULT (getdate())
);
CREATE INDEX [IX_TransactionHistory_ProductID] on [Production].[TransactionHistory]([ProductID]);
CREATE INDEX [IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID] on [Production].[TransactionHistory]([ReferenceOrderID], [ReferenceOrderLineID]);