Tables | SQL 2005 Adventure Works OLTP |
Changes in the cost of a product over time.
Columns
Name Data type Nullable Description ProductID int No Product identification number. Foreign key to Product.ProductID StartDate datetime No Product cost start date. EndDate datetime Yes Product cost end date. StandardCost money No Standard cost of the product. ModifiedDate datetime No Default value: GETDATE()
Date and time the record was last updated.
Constraints
Name Type Columns Description DF_ProductCostHistory_ModifiedDate DEFAULT ModifiedDate Value: GETDATE()
Default constraint value of GETDATE()CK_ProductCostHistory_EndDate CHECK N/A Value: (([EndDate] >= [StartDate]) OR ([EndDate] IS NULL) )
Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULLCK_ProductCostHistory_StandardCost CHECK N/A Value: ([StandardCost] >= 0.00)
Check constraint [StandardCost]>=(0.00)PK_ProductCostHistory_ProductID_StartDate PRIMARY KEY ProductID
StartDateClustered index created by a primary key constraint. FK_ProductCostHistory_Product_ProductID FOREIGN KEY ProductID Reference table: Production.Product
Foreign key constraint referencing Product.ProductID.
Triggers
Name Description Production.uProductCostHistory AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.
Accessed by
Name Description dbo.ufnGetProductStandardCost Scalar function returning the standard cost for a given product on a particular order date.
Modified by
Name Description Production.uProductCostHistory AFTER UPDATE trigger setting the ModifiedDate column in the ProductCostHistory table to the current date.
Applies to
Tables | User