better would be:
CREATE TABLE Item.Items
(
ItemId INT NOT NULL
CONSTRAINT PK_Items_ItemId
PRIMARY KEY IDENTITY,
--------------------------------------------------
CurrentPrice MONEY NOT NULL, -- optional optimization, redundant as
-- current price is available from item.Prices
--------------------------------------------------
Name VARCHAR(100) NOT NULL,
Points INT NOT NULL DEFAULT 0,
Description VARCHAR(5000) NULL
)
CREATE TABLE Item.Prices
(
ItemId INT NOT NULL
CONSTRAINT FK_ItemPrices_Item
FOREIGN KEY REFERENCES Item.Items (ItemId),
EffectiveUtc DATETIME NOT NULL,
Price MONEY NOT NULL,
Constraint [ItemPricesPK] PRIMARY KEY CLUSTERED
(
[ItemId] ASC,
[EffectiveUtc] ASC
)
)
As mentioned by @popovitz, you can always get the price as of any specific date using a correlated subquery ...
Select i.name, p.price
From Item.Items i
Join Item.Prices p
ON i.ItemId = p.ItemId
Where p.EffectiveUtc =
(Select Max(EffectiveUtc )
From Item.Prices
Where ItemId = i.ItemId
And EffectiveUtc <= @asOfDate)