Generated using SQL Data Dictionary demo version.
General sales order information.
Column | Data Type | Identity | Nullable | Default | |
---|---|---|---|---|---|
PK | SalesOrderID | int | X | ||
Primary key. | |||||
RevisionNumber | tinyint | 0 | |||
Incremental number to track changes to the sales order over time. | |||||
OrderDate | datetime | getdate() | |||
Dates the sales order was created. | |||||
DueDate | datetime | ||||
Date the order is due to the customer. | |||||
ShipDate | datetime | X | |||
Date the order was shipped to the customer. | |||||
Status | tinyint | 1 | |||
Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled | |||||
OnlineOrderFlag | Flag(bit) | 1 | |||
0 = Order placed by sales person. 1 = Order placed online by customer. | |||||
UK | SalesOrderNumber | nvarchar(25) | |||
Unique sales order identification number. | |||||
PurchaseOrderNumber | OrderNumber(nvarchar(25)) | X | |||
Customer purchase order number reference. | |||||
AccountNumber | AccountNumber(nvarchar(15)) | X | |||
Financial accounting number reference. | |||||
FK | CustomerID | int | |||
Customer identification number. Foreign key to Customer.BusinessEntityID. | |||||
FK | SalesPersonID | int | X | ||
Sales person who created the sales order. Foreign key to SalesPerson.BusinessEntityID. | |||||
FK | TerritoryID | int | X | ||
Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID. | |||||
FK | BillToAddressID | int | |||
Customer billing address. Foreign key to Address.AddressID. | |||||
FK | ShipToAddressID | int | |||
Customer shipping address. Foreign key to Address.AddressID. | |||||
FK | ShipMethodID | int | |||
Shipping method. Foreign key to ShipMethod.ShipMethodID. | |||||
FK | CreditCardID | int | X | ||
Credit card identification number. Foreign key to CreditCard.CreditCardID. | |||||
CreditCardApprovalCode | varchar(15) | X | |||
Approval code provided by the credit card company. | |||||
FK | CurrencyRateID | int | X | ||
Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID. | |||||
SubTotal | money | 0.00 | |||
Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID. | |||||
TaxAmt | money | 0.00 | |||
Tax amount. | |||||
Freight | money | 0.00 | |||
Shipping cost. | |||||
TotalDue | money | ||||
Total due from customer. Computed as Subtotal + TaxAmt + Freight. | |||||
Comment | nvarchar(128) | X | |||
Sales representative comments. | |||||
UK | rowguid | uniqueidentifier | newid() | ||
ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. | |||||
ModifiedDate | datetime | getdate() | |||
Date and time the record was last updated. |
Primary key (clustered) constraint
Unique nonclustered index. Used to support replication samples.
Unique nonclustered index.
Nonclustered index.
Nonclustered index.
AFTER UPDATE trigger that updates the RevisionNumber and ModifiedDate columns in the SalesOrderHeader table.Updates the SalesYTD column in the SalesPerson and SalesTerritory tables.