Sales.SalesOrderDetail
| Documentation | AdventureWorks |
| Schema | Sales |
| Name | SalesOrderDetail |
| Module | Sales |
Individual products associated with a specific sales order. See SalesOrderHeader.
Columns
| Key | Name | Data type | Null | Attributes | References | Description | ||
|---|---|---|---|---|---|---|---|---|
| 1 | SalesOrderID | int | Sales.SalesOrderHeader | Primary key. Foreign key to SalesOrderHeader.SalesOrderID. | ||||
| Primary key. Foreign key to SalesOrderHeader.SalesOrderID. References: Sales.SalesOrderHeader |
||||||||
| 2 | SalesOrderDetailID | int | Identity | Primary key. One incremental unique number per product sold. | ||||
| Primary key. One incremental unique number per product sold. Identity |
||||||||
| 3 | CarrierTrackingNumber | nvarchar(25) | Shipment tracking number supplied by the shipper. | |||||
| Shipment tracking number supplied by the shipper. |
||||||||
| 4 | OrderQty | smallint | Quantity ordered per product. | |||||
| Quantity ordered per product. |
||||||||
| 5 | ProductID | int | Production.Product Sales.SpecialOfferProduct |
Product sold to customer. Foreign key to Product.ProductID. | ||||
| Product sold to customer. Foreign key to Product.ProductID. References: Production.Product ,Sales.SpecialOfferProduct |
||||||||
| 6 | SpecialOfferID | int | Sales.SpecialOfferProduct | Promotional code. Foreign key to SpecialOffer.SpecialOfferID. | ||||
| Promotional code. Foreign key to SpecialOffer.SpecialOfferID. References: Sales.SpecialOfferProduct |
||||||||
| 7 | UnitPrice | money | Selling price of a single product. | |||||
| Selling price of a single product. |
||||||||
| 8 | UnitPriceDiscount | money | Default: 0.0 | Discount amount. | ||||
| Discount amount. Default: 0.0 |
||||||||
| 9 | LineTotal | numeric(38, 6) | Computed: isnull(([UnitPrice]*((1.0)-[UnitPriceDiscount]))*[OrderQty],(0.0)) | Per product subtotal. Computed as UnitPrice * (1 - UnitPriceDiscount) * OrderQty. | ||||
| Per product subtotal. Computed as UnitPrice * (1 - UnitPriceDiscount) * OrderQty. Computed: isnull(([UnitPrice]*((1.0)-[UnitPriceDiscount]))*[OrderQty],(0.0)) |
||||||||
| 10 | rowguid | uniqueidentifier | Default: newid() | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. | ||||
| ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. Default: newid() |
||||||||
| 11 | ModifiedDate | datetime | Default: getdate() | Date and time the record was last updated. | ||||
| Date and time the record was last updated. Default: getdate() |
||||||||
Relations
| Foreign table | Primary table | Join | Title / Name / Description | |
|---|---|---|---|---|
| Sales.SalesOrderDetail | Production.Product | Sales.SalesOrderDetail.ProductID = Production.Product.ProductID | User-defined relation | |
|
Sales.SalesOrderDetail.ProductID = Production.Product.ProductID Name: User-defined relation |
||||
| Sales.SalesOrderDetail | Sales.SalesOrderHeader | Sales.SalesOrderDetail.SalesOrderID = Sales.SalesOrderHeader.SalesOrderID | FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID Foreign key constraint referencing SalesOrderHeader.PurchaseOrderID. |
|
|
Sales.SalesOrderDetail.SalesOrderID = Sales.SalesOrderHeader.SalesOrderID Name: FK_SalesOrderDetail_SalesOrderHeader_SalesOrderIDForeign key constraint referencing SalesOrderHeader.PurchaseOrderID. |
||||
| Sales.SalesOrderDetail | Sales.SpecialOfferProduct | Sales.SalesOrderDetail.SpecialOfferID = Sales.SpecialOfferProduct.SpecialOfferID Sales.SalesOrderDetail.ProductID = Sales.SpecialOfferProduct.ProductID |
FK_SalesOrderDetail_SpecialOfferProduct_SpecialOfferIDProductID Foreign key constraint referencing SpecialOfferProduct.SpecialOfferIDProductID. |
|
|
Sales.SalesOrderDetail.SpecialOfferID = Sales.SpecialOfferProduct.SpecialOfferID Name: FK_SalesOrderDetail_SpecialOfferProduct_SpecialOfferIDProductIDSales.SalesOrderDetail.ProductID = Sales.SpecialOfferProduct.ProductID Foreign key constraint referencing SpecialOfferProduct.SpecialOfferIDProductID. |
||||
Unique keys
| Key name | Columns | Description | |
|---|---|---|---|
| PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID | SalesOrderID, SalesOrderDetailID | Primary key (clustered) constraint | |
| Primary key (clustered) constraint | |||
| AK_SalesOrderDetail_rowguid | rowguid | Unique nonclustered index. Used to support replication samples. | |
| Unique nonclustered index. Used to support replication samples. | |||
Triggers
| Key name | When | Description | |
|---|---|---|---|
| iduSalesOrderDetail | After Insert, Update, Delete | AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column. | |
| AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column. | |||
Uses
| Name |
|---|
|
Sales.SalesOrderDetail
|
|
Sales.SalesOrderDetail
|
|
Sales.iduSalesOrderDetail
|
|
Sales.SalesOrderDetail
|
Used by
| Name |
|---|
|
Sales.SalesOrderDetail
|
|
Sales.SalesOrderDetail
|
|
Sales.iduSalesOrderDetail
|
Exported: 2019-02-04 23:13, Last imported: 2018-03-07 11:56
