Difference between revisions of "Sales.SalesOrderHeader (table)"
Line 310: | Line 310: | ||
| not null | | not null | ||
| | | | ||
− | | Primary key.PK_SalesOrderHeader_SalesOrderID | + | | Primary key.<br />PK_SalesOrderHeader_SalesOrderID |
|- valign="top" | |- valign="top" | ||
| RevisionNumber | | RevisionNumber | ||
Line 316: | Line 316: | ||
| not null | | not null | ||
| (0) | | (0) | ||
− | | Incremental number to track changes to the sales order over time. | + | | Incremental number to track changes to the sales order over time.<br /> |
|- valign="top" | |- valign="top" | ||
| OrderDate | | OrderDate | ||
Line 322: | Line 322: | ||
| not null | | not null | ||
| (GETDATE()) | | (GETDATE()) | ||
− | | Dates the sales order was created. | + | | Dates the sales order was created.<br /> |
|- valign="top" | |- valign="top" | ||
| DueDate | | DueDate | ||
Line 328: | Line 328: | ||
| not null | | not null | ||
| | | | ||
− | | Date the order is due to the customer. | + | | Date the order is due to the customer.<br /> |
|- valign="top" | |- valign="top" | ||
| ShipDate | | ShipDate | ||
Line 334: | Line 334: | ||
| null | | null | ||
| | | | ||
− | | Date the order was shipped to the customer. | + | | Date the order was shipped to the customer.<br /> |
|- valign="top" | |- valign="top" | ||
| Status | | Status | ||
Line 340: | Line 340: | ||
| not null | | not null | ||
| (1) | | (1) | ||
− | | Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled | + | | Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled<br /> |
|- valign="top" | |- valign="top" | ||
| OnlineOrderFlag | | OnlineOrderFlag | ||
Line 346: | Line 346: | ||
| not null | | not null | ||
| (1) | | (1) | ||
− | | 0 = Order placed by sales person. 1 = Order placed online by customer. | + | | 0 = Order placed by sales person. 1 = Order placed online by customer.<br /> |
|- valign="top" | |- valign="top" | ||
| SalesOrderNumber | | SalesOrderNumber | ||
Line 352: | Line 352: | ||
| | | | ||
| | | | ||
− | | Unique sales order identification number.AK_SalesOrderHeader_SalesOrderNumber | + | | Unique sales order identification number.<br />AK_SalesOrderHeader_SalesOrderNumber |
|- valign="top" | |- valign="top" | ||
| PurchaseOrderNumber | | PurchaseOrderNumber | ||
Line 358: | Line 358: | ||
| null | | null | ||
| | | | ||
− | | Customer purchase order number reference. | + | | Customer purchase order number reference. <br /> |
|- valign="top" | |- valign="top" | ||
| AccountNumber | | AccountNumber | ||
Line 364: | Line 364: | ||
| null | | null | ||
| | | | ||
− | | Financial accounting number reference. | + | | Financial accounting number reference.<br /> |
|- valign="top" | |- valign="top" | ||
| CustomerID | | CustomerID | ||
Line 370: | Line 370: | ||
| not null | | not null | ||
| | | | ||
− | | Customer identification number. Foreign key to Customer.CustomerID.IX_SalesOrderHeader_CustomerID | + | | Customer identification number. Foreign key to Customer.CustomerID.<br />IX_SalesOrderHeader_CustomerID |
|- valign="top" | |- valign="top" | ||
| ContactID | | ContactID | ||
Line 376: | Line 376: | ||
| not null | | not null | ||
| | | | ||
− | | Customer contact identification number. Foreign key to Contact.ContactID. | + | | Customer contact identification number. Foreign key to Contact.ContactID.<br /> |
|- valign="top" | |- valign="top" | ||
| SalesPersonID | | SalesPersonID | ||
Line 382: | Line 382: | ||
| null | | null | ||
| | | | ||
− | | Sales person who created the sales order. Foreign key to SalesPerson.SalePersonID.IX_SalesOrderHeader_SalesPersonID | + | | Sales person who created the sales order. Foreign key to SalesPerson.SalePersonID.<br />IX_SalesOrderHeader_SalesPersonID |
|- valign="top" | |- valign="top" | ||
| TerritoryID | | TerritoryID | ||
Line 388: | Line 388: | ||
| null | | null | ||
| | | | ||
− | | Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID. | + | | Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID.<br /> |
|- valign="top" | |- valign="top" | ||
| BillToAddressID | | BillToAddressID | ||
Line 394: | Line 394: | ||
| not null | | not null | ||
| | | | ||
− | | Customer billing address. Foreign key to Address.AddressID. | + | | Customer billing address. Foreign key to Address.AddressID.<br /> |
|- valign="top" | |- valign="top" | ||
| ShipToAddressID | | ShipToAddressID | ||
Line 400: | Line 400: | ||
| not null | | not null | ||
| | | | ||
− | | Customer shipping address. Foreign key to Address.AddressID. | + | | Customer shipping address. Foreign key to Address.AddressID.<br /> |
|- valign="top" | |- valign="top" | ||
| ShipMethodID | | ShipMethodID | ||
Line 406: | Line 406: | ||
| not null | | not null | ||
| | | | ||
− | | Shipping method. Foreign key to ShipMethod.ShipMethodID. | + | | Shipping method. Foreign key to ShipMethod.ShipMethodID.<br /> |
|- valign="top" | |- valign="top" | ||
| CreditCardID | | CreditCardID | ||
Line 412: | Line 412: | ||
| null | | null | ||
| | | | ||
− | | Credit card identification number. Foreign key to CreditCard.CreditCardID. | + | | Credit card identification number. Foreign key to CreditCard.CreditCardID.<br /> |
|- valign="top" | |- valign="top" | ||
| CreditCardApprovalCode | | CreditCardApprovalCode | ||
Line 418: | Line 418: | ||
| null | | null | ||
| | | | ||
− | | Approval code provided by the credit card company. | + | | Approval code provided by the credit card company.<br /> |
|- valign="top" | |- valign="top" | ||
| CurrencyRateID | | CurrencyRateID | ||
Line 424: | Line 424: | ||
| null | | null | ||
| | | | ||
− | | Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID. | + | | Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID.<br /> |
|- valign="top" | |- valign="top" | ||
| SubTotal | | SubTotal | ||
Line 430: | Line 430: | ||
| not null | | not null | ||
| (0.00) | | (0.00) | ||
− | | Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID. | + | | Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID.<br /> |
|- valign="top" | |- valign="top" | ||
| TaxAmt | | TaxAmt | ||
Line 436: | Line 436: | ||
| not null | | not null | ||
| (0.00) | | (0.00) | ||
− | | Tax amount. | + | | Tax amount.<br /> |
|- valign="top" | |- valign="top" | ||
| Freight | | Freight | ||
Line 442: | Line 442: | ||
| not null | | not null | ||
| (0.00) | | (0.00) | ||
− | | Shipping cost. | + | | Shipping cost.<br /> |
|- valign="top" | |- valign="top" | ||
| TotalDue | | TotalDue | ||
Line 448: | Line 448: | ||
| | | | ||
| | | | ||
− | | Total due from customer. Computed as Subtotal + TaxAmt + Freight. | + | | Total due from customer. Computed as Subtotal + TaxAmt + Freight.<br /> |
|- valign="top" | |- valign="top" | ||
| Comment | | Comment | ||
Line 454: | Line 454: | ||
| null | | null | ||
| | | | ||
− | | Sales representative comments. | + | | Sales representative comments.<br /> |
|- valign="top" | |- valign="top" | ||
| rowguid | | rowguid | ||
Line 460: | Line 460: | ||
| not null | | not null | ||
| (NEWID()) | | (NEWID()) | ||
− | | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.AK_SalesOrderHeader_rowguid | + | | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.<br />AK_SalesOrderHeader_rowguid |
|- valign="top" | |- valign="top" | ||
| ModifiedDate | | ModifiedDate | ||
Line 466: | Line 466: | ||
| not null | | not null | ||
| (GETDATE()) | | (GETDATE()) | ||
− | | Date and time the record was last updated. | + | | Date and time the record was last updated.<br /> |
|} | |} | ||
Revision as of 00:10, 27 November 2009
wikibot
Table | Sales.SalesOrderHeader |
Column | Data Type | Nullable | Default | PK | Index |
SalesOrderID | int | not null | PK_SalesOrderHeader_SalesOrderID | ||
RevisionNumber | tinyint | not null | ((0)) | ||
OrderDate | datetime | not null | (getdate()) | ||
DueDate | datetime | not null | |||
ShipDate | datetime | null | |||
Status | tinyint | not null | ((1)) | ||
OnlineOrderFlag | dbo.Flag | not null | ((1)) | ||
SalesOrderNumber | AK_SalesOrderHeader_SalesOrderNumber | ||||
PurchaseOrderNumber | dbo.OrderNumber | null | |||
AccountNumber | dbo.AccountNumber | null | |||
CustomerID | int | not null | IX_SalesOrderHeader_CustomerID | ||
ContactID | int | not null | |||
SalesPersonID | int | null | IX_SalesOrderHeader_SalesPersonID | ||
TerritoryID | int | null | |||
BillToAddressID | int | not null | |||
ShipToAddressID | int | not null | |||
ShipMethodID | int | not null | |||
CreditCardID | int | null | |||
CreditCardApprovalCode | varchar(15) | null | |||
CurrencyRateID | int | null | |||
SubTotal | money | not null | ((0.00)) | ||
TaxAmt | money | not null | ((0.00)) | ||
Freight | money | not null | ((0.00)) | ||
TotalDue | |||||
Comment | nvarchar(128) | null | |||
rowguid | uniqueidentifier | not null | (newid()) | AK_SalesOrderHeader_rowguid | |
ModifiedDate | datetime | not null | (getdate()) |
Relation | Column | Referenced Column |
Person.Address | BillToAddressID | AddressID |
Person.Address | ShipToAddressID | AddressID |
Person.Contact | ContactID | ContactID |
Sales.CreditCard | CreditCardID | CreditCardID |
Sales.CurrencyRate | CurrencyRateID | CurrencyRateID |
Sales.Customer | CustomerID | CustomerID |
Sales.SalesPerson | SalesPersonID | SalesPersonID |
Sales.SalesTerritory | TerritoryID | TerritoryID |
Purchasing.ShipMethod | ShipMethodID | ShipMethodID |
Detail Table | Column | Referencing Column |
Sales.SalesOrderDetail | SalesOrderID | SalesOrderID |
Sales.SalesOrderHeaderSalesReason | SalesOrderID | SalesOrderID |
Triggers | Type |
uSalesOrderHeader | ON UPDATE |
automatically generated
Table | Sales.SalesOrderHeader |
Description | General sales order information. |
Column | Data Type | Nullable | Default | Description / PK / Index |
SalesOrderID | int | not null | Primary key. PK_SalesOrderHeader_SalesOrderID | |
RevisionNumber | tinyint | not null | (0) | Incremental number to track changes to the sales order over time. |
OrderDate | datetime | not null | (GETDATE()) | Dates the sales order was created. |
DueDate | datetime | not null | Date the order is due to the customer. | |
ShipDate | datetime | null | Date the order was shipped to the customer. | |
Status | tinyint | not null | (1) | Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled |
OnlineOrderFlag | Flag | not null | (1) | 0 = Order placed by sales person. 1 = Order placed online by customer. |
SalesOrderNumber | Unique sales order identification number. AK_SalesOrderHeader_SalesOrderNumber | |||
PurchaseOrderNumber | OrderNumber | null | Customer purchase order number reference. | |
AccountNumber | AccountNumber | null | Financial accounting number reference. | |
CustomerID | int | not null | Customer identification number. Foreign key to Customer.CustomerID. IX_SalesOrderHeader_CustomerID | |
ContactID | int | not null | Customer contact identification number. Foreign key to Contact.ContactID. | |
SalesPersonID | int | null | Sales person who created the sales order. Foreign key to SalesPerson.SalePersonID. IX_SalesOrderHeader_SalesPersonID | |
TerritoryID | int | null | Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID. | |
BillToAddressID | int | not null | Customer billing address. Foreign key to Address.AddressID. | |
ShipToAddressID | int | not null | Customer shipping address. Foreign key to Address.AddressID. | |
ShipMethodID | int | not null | Shipping method. Foreign key to ShipMethod.ShipMethodID. | |
CreditCardID | int | null | Credit card identification number. Foreign key to CreditCard.CreditCardID. | |
CreditCardApprovalCode | varchar(15) | null | Approval code provided by the credit card company. | |
CurrencyRateID | int | null | Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID. | |
SubTotal | money | not null | (0.00) | Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID. |
TaxAmt | money | not null | (0.00) | Tax amount. |
Freight | money | not null | (0.00) | Shipping cost. |
TotalDue | Total due from customer. Computed as Subtotal + TaxAmt + Freight. | |||
Comment | nvarchar(128) | null | Sales representative comments. | |
rowguid | uniqueidentifier | not null | (NEWID()) | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. AK_SalesOrderHeader_rowguid |
ModifiedDate | datetime | not null | (GETDATE()) | Date and time the record was last updated. |
Relation | Column | Referenced Column |
Person.Address | BillToAddressID | AddressID |
Person.Address | ShipToAddressID | AddressID |
Person.Contact | ContactID | ContactID |
Sales.CreditCard | CreditCardID | CreditCardID |
Sales.CurrencyRate | CurrencyRateID | CurrencyRateID |
Sales.Customer | CustomerID | CustomerID |
Sales.SalesPerson | SalesPersonID | SalesPersonID |
Sales.SalesTerritory | TerritoryID | TerritoryID |
Purchasing.ShipMethod | ShipMethodID | ShipMethodID |
Detail Table | Column | Referencing Column |
Sales.SalesOrderDetail | SalesOrderID | SalesOrderID |
Sales.SalesOrderHeaderSalesReason | SalesOrderID | SalesOrderID |
Triggers | Type |
uSalesOrderHeader | ON UPDATE |
Referenced Object | Object Type | Dependency Type |
dbo.AccountNumber | Type | Data Type |
dbo.Flag | Type | Data Type |
dbo.OrderNumber | Type | Data Type |
Sales.SalesOrderHeader | Table | Select |
Sales.SalesOrderHeader | Table | Update |
Sales.SalesPerson | Table | Update |
Sales.SalesTerritory | Table | Update |
dbo.uspLogError | Procedure | Execute |
dbo.uspPrintError | Procedure | Execute |
dbo.ufnGetAccountingEndDate | Function | Execute |
dbo.ufnGetAccountingStartDate | Function | Execute |
Referencing Object | Object Type | Reference Type |
Sales.vSalesPersonSalesByFiscalYears | View | Select |
Sales.SalesOrderDetail | Table | Select |
Sales.SalesOrderDetail | Table | Update |
Sales.SalesOrderHeader | Table | Select |
Sales.SalesOrderHeader | Table | Update |