AdventureWorks
| Table Name: | Production.TransactionHistory |
| Description: | Record of each purchase order, sales order, or work order transaction year to date. |
| Primary Keys: | TransactionID |
| Field | Type | Defaults | Nulls? | Comments |
|---|---|---|---|---|
| TransactionID | int - Identity | None | No | Primary key for TransactionHistory records. |
| ProductID | int | None | No | Product identification number. Foreign key to Product.ProductID. |
| ReferenceOrderID | int | None | No | Purchase order, sales order, or work order identification number. |
| ReferenceOrderLineID | int | ((0)) | No | Line number associated with the purchase order, sales order, or work order. |
| TransactionDate | datetime | (getdate()) | No | Date and time of the transaction. |
| TransactionType | nchar (1) | None | No | W = WorkOrder, S = SalesOrder, P = PurchaseOrder |
| Quantity | int | None | No | Product quantity. |
| ActualCost | money | None | No | Product cost. |
| ModifiedDate | datetime | (getdate()) | No | Date and time the record was last updated. |
| Index | Clustered? | Unique? | Fields |
|---|---|---|---|
| PK_TransactionHistory_TransactionID | Yes | Yes | TransactionID |
| IX_TransactionHistory_ProductID | No | No | ProductID |
| IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID | No | No | ReferenceOrderID ReferenceOrderLineID |
| Check Constraint | Text |
|---|---|
| CK_TransactionHistory_TransactionType | (upper([TransactionType])='P' OR upper([TransactionType])='S' OR upper([TransactionType])='W') |
| Internal Foreign Key Constraint | Affected Field | Source Table |
|---|---|---|
| FK_TransactionHistory_Product_ProductID | ProductID | Production.Product |