Tables SQL 2005 Adventure Works OLTP

Sales.SalesOrderDetail

Object type: Table

Individual products associated with a specific sales order. See SalesOrderHeader.

Columns 

Name  Data type  Nullable  Description 
SalesOrderID  int  No Primary key. Foreign key to SalesOrderHeader.SalesOrderID. 
SalesOrderDetailID  int  No Column has identity seed value of 1 with a step value of 1.
Primary key. One line number per product sold. 
CarrierTrackingNumber  nvarchar(25)  Yes Shipment tracking number supplied by the shipper. 
OrderQty  smallint  No Quantity ordered per product. 
ProductID  int  No Product sold to customer. Foreign key to Product.ProductID. 
SpecialOfferID  int  No Promotional code. Foreign key to SpecialOffer.SpecialOfferID. 
UnitPrice  money  No Selling price of a single product. 
UnitPriceDiscount  money  No Default value: 0.0
Discount amount. 
LineTotal  ISNULL([UnitPrice] * (1.0 - [UnitPriceDiscount]) * [OrderQty], 0.0)  Yes Per product subtotal. Computed as UnitPrice * (1 - UnitPriceDiscount) * OrderQty. 
rowguid  uniqueidentifier  No Default value: NEWID()
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. 
ModifiedDate  datetime  No Default value: GETDATE()
Date and time the record was last updated. 

Constraints 

Name  Type  Columns  Description 
DF_SalesOrderDetail_UnitPriceDiscount  DEFAULT  UnitPriceDiscount  Value: 0.0
Default constraint value of 0.0 
DF_SalesOrderDetail_rowguid  DEFAULT  rowguid  Value: NEWID()
Default constraint value of NEWID() 
DF_SalesOrderDetail_ModifiedDate  DEFAULT  ModifiedDate  Value: GETDATE()
Default constraint value of GETDATE() 
CK_SalesOrderDetail_OrderQty  CHECK  N/A  Value: ([OrderQty] > 0)
Check constraint [OrderQty]>(0) 
CK_SalesOrderDetail_UnitPrice  CHECK  N/A  Value: ([UnitPrice] >= 0.00)
Check constraint [UnitPrice]>=(0.00) 
CK_SalesOrderDetail_UnitPriceDiscount  CHECK  N/A  Value: ([UnitPriceDiscount] >= 0.00)
Check constraint [UnitPriceDiscount]>=(0.00) 
PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID  PRIMARY KEY  SalesOrderID
SalesOrderDetailID 
Clustered index created by a primary key constraint. 
FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID  FOREIGN KEY  SalesOrderID  Reference table: Sales.SalesOrderHeader
Foreign key constraint referencing SalesOrderHeader.PurchaseOrderID. 
FK_SalesOrderDetail_SpecialOfferProduct_SpecialOfferIDProductID  FOREIGN KEY  SpecialOfferID
ProductID 
Reference table: Sales.SpecialOfferProduct
Foreign key constraint referencing SpecialOfferProduct.SpecialOfferIDProductID. 

Indices 

Name  Description 
AK_SalesOrderDetail_rowguid  Unique nonclustered index.Used to support replication samples. 
IX_SalesOrderDetail_ProductID  Nonclustered index. 

Triggers 

Name  Description 
Sales.iduSalesOrderDetail  AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column. 

Accessed by 

Name  Description 
Company Sales  Adventure Works sales by quarter and product category. This report illustrates the use of a matrix data region that provides drilldown from summary data into detail data by showing and hiding rows. This report also illustrates the use of background images. 
Employee Sales Summary  Adventure Works sales for an individual employee. This report includes Sales Comparison and Current Month Sales Comparison charts in addition to a Current Month Order Summary table with drillthrough to individual orders. This report illustrates the use of multiple datasets, charts, tables, drillthrough, and dynamic parameters. 
Product Line Sales  Adventure Works top five sales people and stores. This report illustrates a dataset with queries containing the TOP clause. It also illustrates the use of tables, charts, parameters, calculated fields, and drillthrough links. 
Sales Order Detail  Detail of an individual Adventure Works order. This report can be accessed as a drillthrough report from the Employee Sales Summary and Territory Sales drilldown report. This report illustrates the use of lists, tables, parameters, and expressions. 
Sales.iduSalesOrderDetail  AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column. 

Modified by 

Name  Description 
Sales.iduSalesOrderDetail  AFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column. 

Applies to

Tables | User
The AdventureWorks database sample was developed by Microsoft Corporation, copyright 2005. SQL Server is a trademark of Microsoft Corporation

Document was prepared on: Thursday, April 05, 2007
Help compiled by DBDocumentor, a Pikauba Software product. All rights reserved.