AdventureWorks

Basic Index   Expanded Index

Table Name:Production.TransactionHistory
Description:Record of each purchase order, sales order, or work order transaction year to date.
Primary Keys:TransactionID
FieldTypeDefaultsNulls?Comments
TransactionIDint - IdentityNoneNoPrimary key for TransactionHistory records.
ProductIDintNoneNoProduct identification number. Foreign key to Product.ProductID.
ReferenceOrderIDintNoneNoPurchase order, sales order, or work order identification number.
ReferenceOrderLineIDint((0))NoLine number associated with the purchase order, sales order, or work order.
TransactionDatedatetime(getdate())NoDate and time of the transaction.
TransactionTypenchar (1)NoneNoW = WorkOrder, S = SalesOrder, P = PurchaseOrder
QuantityintNoneNoProduct quantity.
ActualCostmoneyNoneNoProduct cost.
ModifiedDatedatetime(getdate())NoDate and time the record was last updated.

IndexClustered?Unique?Fields
PK_TransactionHistory_TransactionIDYesYesTransactionID
IX_TransactionHistory_ProductIDNoNoProductID
IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineIDNoNoReferenceOrderID
ReferenceOrderLineID

Check ConstraintText
CK_TransactionHistory_TransactionType(upper([TransactionType])='P' OR upper([TransactionType])='S' OR upper([TransactionType])='W')

Internal Foreign Key ConstraintAffected FieldSource Table
FK_TransactionHistory_Product_ProductIDProductIDProduction.Product

No primary keys as foreign key constraints
No triggers