Production.ProductCostHistory Table
In This Topic
Description
Changes in the cost of a product over time.
Properties
Creation Date | 27/10/2017 14:33 |
File Group | PRIMARY |
Text File Group | |
System Object |  |
Published for Replication |  |
Rows | 395 |
Data Space Used | 24.00 KB |
Index Space Used | 16.00 KB |
Columns
| Column Name | Description | Datatype | Length | Allow Nulls | Default | Formula |
| ProductID | Product identification number. Foreign key to Product.ProductID | Integer | 4 | | | |
| StartDate | Product cost start date. | DBTimeStamp | 4 | | | |
| EndDate | Product cost end date. | DBTimeStamp | 4 |  | | |
| StandardCost | Standard cost of the product. | Currency | 8 | | | |
| ModifiedDate | Date and time the record was last updated. | DBTimeStamp | 4 | | (getdate()) | |
Indexes
Check Constraints
Name | Description | Expression |
CK_ProductCostHistory_EndDate | Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL | ([EndDate]>=[StartDate] OR [EndDate] IS NULL) |
CK_ProductCostHistory_StandardCost | Check constraint [StandardCost] >= (0.00) | ([StandardCost]>=(0.00)) |
Relationships
Objects that depend on Production.ProductCostHistory
| Database Object | Object Type | Description | Dep Level |
 | dbo.ufnGetProductStandardCost | User Defined Function | Scalar function returning the standard cost for a given product on a particular order date. | 2 |
Objects that Production.ProductCostHistory depends on
SQL
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [Production].[ProductCostHistory](
[ProductID] [int] NOT NULL,
[StartDate] [datetime] NOT NULL,
[EndDate] [datetime] NULL,
[StandardCost] [money] NOT NULL,
[ModifiedDate] [datetime] NOT NULL,
CONSTRAINT [PK_ProductCostHistory_ProductID_StartDate] PRIMARY KEY CLUSTERED
(
[ProductID] ASC,
[StartDate] 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].[ProductCostHistory] ADD CONSTRAINT [DF_ProductCostHistory_ModifiedDate] DEFAULT (getdate()) FOR [ModifiedDate]
ALTER TABLE [Production].[ProductCostHistory] WITH CHECK ADD CONSTRAINT [FK_ProductCostHistory_Product_ProductID] FOREIGN KEY([ProductID])
REFERENCES [Production].[Product] ([ProductID])
ALTER TABLE [Production].[ProductCostHistory] CHECK CONSTRAINT [FK_ProductCostHistory_Product_ProductID]
ALTER TABLE [Production].[ProductCostHistory] WITH CHECK ADD CONSTRAINT [CK_ProductCostHistory_EndDate] CHECK (([EndDate]>=[StartDate] OR [EndDate] IS NULL))
ALTER TABLE [Production].[ProductCostHistory] CHECK CONSTRAINT [CK_ProductCostHistory_EndDate]
ALTER TABLE [Production].[ProductCostHistory] WITH CHECK ADD CONSTRAINT [CK_ProductCostHistory_StandardCost] CHECK (([StandardCost]>=(0.00)))
ALTER TABLE [Production].[ProductCostHistory] CHECK CONSTRAINT [CK_ProductCostHistory_StandardCost]
|
See Also