Sales.SalesOrderHeader

Table: 'Sales.SalesOrderHeader'

27 fields. 608 bytes.

General sales order information.

Field NameData TypeSizeOriginal TypeDefaultNullableDescriptionCheck
SalesOrderIDint identity int Not nullPrimary key. 
RevisionNumbertinyint  (0)Not nullIncremental number to track changes to the sales order over time. 
OrderDatedatetime  getdate()Not nullDates the sales order was created. 
DueDatedatetime   Not nullDate the order is due to the customer. 
ShipDatedatetime   NullDate the order was shipped to the customer. 
Statustinyint  (1)Not nullOrder current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled([Status]>=(0) AND [Status]<=(8))
OnlineOrderFlagFlag bit(1)Not null0 = Order placed by sales person. 1 = Order placed online by customer. 
SalesOrderNumbernvarchar25  Not nullUnique sales order identification number. 
PurchaseOrderNumberOrderNumber nvarchar(25) NullCustomer purchase order number reference.  
AccountNumberAccountNumber nvarchar(15) NullFinancial accounting number reference. 
CustomerIDint   Not nullCustomer identification number. Foreign key to Customer.CustomerID. 
ContactIDint   Not nullCustomer contact identification number. Foreign key to Contact.ContactID. 
SalesPersonIDint   NullSales person who created the sales order. Foreign key to SalesPerson.SalePersonID. 
TerritoryIDint   NullTerritory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID. 
BillToAddressIDint   Not nullCustomer billing address. Foreign key to Address.AddressID. 
ShipToAddressIDint   Not nullCustomer shipping address. Foreign key to Address.AddressID. 
ShipMethodIDint   Not nullShipping method. Foreign key to ShipMethod.ShipMethodID. 
CreditCardIDint   NullCredit card identification number. Foreign key to CreditCard.CreditCardID. 
CreditCardApprovalCodevarchar15  NullApproval code provided by the credit card company. 
CurrencyRateIDint   NullCurrency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID. 
SubTotalmoney19,4decimal(19,4)(0.00)Not nullSales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID.([SubTotal]>=(0.00))
TaxAmtmoney19,4decimal(19,4)(0.00)Not nullTax amount.([TaxAmt]>=(0.00))
Freightmoney19,4decimal(19,4)(0.00)Not nullShipping cost.([Freight]>=(0.00))
TotalDuemoney19,4decimal(19,4) Not nullTotal due from customer. Computed as Subtotal + TaxAmt + Freight. 
Commentnvarchar128  NullSales representative comments. 
rowguiduniqueidentifier  newid()Not nullROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. 
ModifiedDatedatetime  getdate()Not nullDate and time the record was last updated. 

Extended Properties

The object has no extended properties.

Primary key for table 'Sales.SalesOrderHeader'

Primary Key NameField Name
PK_SalesOrderHeader_SalesOrderIDSalesOrderID

Foreign keys for table 'Sales.SalesOrderHeader', 9 items

ForeignPrimaryKey Name
SalesOrderHeader.BillToAddressIDAddress.AddressIDFK_SalesOrderHeader_Address_BillToAddressID
SalesOrderHeader.ShipToAddressIDAddress.AddressIDFK_SalesOrderHeader_Address_ShipToAddressID
SalesOrderHeader.ContactIDContact.ContactIDFK_SalesOrderHeader_Contact_ContactID
SalesOrderHeader.ShipMethodIDShipMethod.ShipMethodIDFK_SalesOrderHeader_ShipMethod_ShipMethodID
SalesOrderHeader.CreditCardIDCreditCard.CreditCardIDFK_SalesOrderHeader_CreditCard_CreditCardID
SalesOrderHeader.CurrencyRateIDCurrencyRate.CurrencyRateIDFK_SalesOrderHeader_CurrencyRate_CurrencyRateID
SalesOrderHeader.CustomerIDCustomer.CustomerIDFK_SalesOrderHeader_Customer_CustomerID
SalesOrderHeader.SalesPersonIDSalesPerson.SalesPersonIDFK_SalesOrderHeader_SalesPerson_SalesPersonID
SalesOrderHeader.TerritoryIDSalesTerritory.TerritoryIDFK_SalesOrderHeader_SalesTerritory_TerritoryID

Indexes for table 'Sales.SalesOrderHeader', 5 items

Index NameDescriptionClusteredUniqueFields
PK_SalesOrderHeader_SalesOrderIDClustered index created by a primary key constraint.YesYesSalesOrderID
AK_SalesOrderHeader_rowguidUnique nonclustered index. Used to support replication samples.NoYesrowguid
AK_SalesOrderHeader_SalesOrderNumberUnique nonclustered index.NoYesSalesOrderNumber
IX_SalesOrderHeader_CustomerIDNonclustered index.NoNoCustomerID
IX_SalesOrderHeader_SalesPersonIDNonclustered index.NoNoSalesPersonID

Triggers for table 'Sales.SalesOrderHeader', 1 item

NameDescriptionTypeEnabled
uSalesOrderHeaderAFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.after Update Yes

Dependencies for table 'Sales.SalesOrderHeader', 4 items

Object NameTypeField Name
Sales.SalesOrderHeaderuser tableSalesOrderID
Sales.SalesOrderHeaderuser tableSubTotal
Sales.SalesOrderHeaderuser tableTaxAmt
Sales.SalesOrderHeaderuser tableFreight